-
Notifications
You must be signed in to change notification settings - Fork 127
/
Copy pathpackaging.html
152 lines (152 loc) · 13.2 KB
/
packaging.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta charset="utf-8" />
<meta name="generator" content="pandoc" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
<title>Packaging PyRadio</title>
<style>
body {padding: 2em;}
@media screen and (max-width: 770px) {
body {padding: 10px;}
}
body {max-width: 750px; margin: auto;}
h2 {margin-top: 2.5em; border-bottom:1px solid SaddleBrown; color: SaddleBrown;}
h3 {margin-top: 2em; color: SaddleBrown; text-decoration: underline SaddleBrown}
h4 {margin: 2em 0 1em 0; color: SaddleBrown; font-size: 1em;}
h4:before {content: "# "; font-weight: bold; vertical-align: middle;}
h5 {margin: 2em 0 1em 0; color: SaddleBrown; font-size: 1em;;}
h5:before {content: "## "; font-weight: bold; vertical-align: middle;}
p, table, ol, ul {margin-left: .8em;}
STRONG {color: SaddleBrown;}
dl {margin: 2em;}
dd {margin: 1em;}
dt {font-weight: bold;}
TABLE {border: 1px solid SaddleBrown; border-collapse: collapse; margin-left: auto; margin-right: auto; border-radius: 5px; -moz-border-radius: 5px; border-collapse:separate; box-shadow: 5px 5px 15px #888888;}
TH {text-align: left; vertical-align: top; padding: 5px;color: SaddleBrown;border: 1px solid SaddleBrown; background-color: SaddleBrown; color: white;}
TD {text-align: left; vertical-align: top; padding: 5px 10px;border: 1px solid SaddleBrown;}
pre { background-color: rgba(245, 245, 245, 1); color: #474747; padding: 1.5em; border: 1px solid #C7C7C7; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; overflow: auto; box-shadow: 5px 5px 15px #C7C7C7;}
.task-list {list-style-type: none; padding: 0; margin: 0 0 0 1em ;}
img{display: block; margin-left: auto; margin-right: auto; max-width: 35%; width: 100%; background:transparent; padding:3px; border:1px solid #999999; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; box-shadow:5px 5px 15px #888888;}
.indented {text-indent: -1.5em; padding-left: 1.5em; margin-left: 1em;}
a{ color: SaddleBrown;}
a:visited{color: SaddleBrown;}
</style>
</head>
<body>
<header id="title-block-header">
</header>
<h1 style="color: SaddleBrown" id="packaging-pyradio">Packaging PyRadio</h1>
<h2 id="table-of-contents">Table of Contents <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
<!-- vim-markdown-toc Marked -->
<ul>
<li><a href="#packaging-status">Packaging status</a></li>
<li><a href="#dependencies">Dependencies</a></li>
<li><a href="#files-to-change">Files to change</a>
<ul>
<li><a href="#distro-name-(must-do)">distro name (must do)</a></li>
<li><a href="#xdg-base-directory-specification-compliance">XDG Base Directory Specification Compliance</a></li>
<li><a href="#desktop-notifications-(optional)">Desktop Notifications (optional)</a>
<ul>
<li><a href="#desktop-notification-icons-(optional)">Desktop Notification Icons (optional)</a></li>
</ul></li>
<li><a href="#desktop-file-location">Desktop File location</a></li>
<li><a href="#pyradio/__pycache__">pyradio/__pycache__</a></li>
</ul></li>
<li><a href="#recordings-directory">Recordings Directory</a></li>
<li><a href="#mkvtoolnix-cli-installation">MKVToolNix cli installation</a></li>
<li><a href="#resource-opener-(linux-only)">Resource opener (Linux only)</a></li>
</ul>
<!-- vim-markdown-toc -->
<p class="indented">[ <a href="index.html#packaging-pyradio">Back to main doc</a> ]</p>
<h2 id="packaging-status">Packaging status <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
<p>The following data is provided by <a target="_blank" href="https://repology.org/">Repology, the packaging hub</a>.</p>
<!-- [](https://repology.org/project/pyradio/versions) -->
<p><a target="_blank" href="https://repology.org/project/pyradio/versions"> <img style="width: 35%" src="https://repology.org/badge/vertical-allrepos/pyradio.svg" alt="Packaging status"> </a></p>
<h2 id="dependencies">Dependencies <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
<p>First of all, you have to decide on the player that’s going to be used. Three players are supported:</p>
<ol type="1">
<li>mpv</li>
<li>plmayer</li>
<li>vlc</li>
</ol>
<p>Make sure one of them is included in the dependencies.</p>
<p>Then you have to add the following python modules to the relevant section of your manifest (or whatever) file:</p>
<ol type="1">
<li>requests</li>
<li>dnspython</li>
<li>psutil</li>
<li>rich</li>
<li>netifaces</li>
<li>dateutil</li>
</ol>
<h2 id="files-to-change">Files to change <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
<p>You will have to modify a couple of files to tailor <strong>PyRadio</strong>’ to your needs and liking.</p>
<h3 id="distro-name-must-do">distro name (must do)</h3>
<p><strong>PyRadio</strong> is able to update and uninstall itself, when installed from source. This is something you do not want to be happening when your package is used; <strong>PyRadio</strong> should be updated and uninstalled using the distro package manager.</p>
<p>In order to accomplice that, you just have to change the <strong>distro</strong> configuration parameter in the <strong>config</strong> file. <strong>PyRadio</strong> will read this parameter and will disable updating and uninstalling, when set to anything other than “<strong>None</strong>”. So, here’s how you do that:</p>
<p>Once you are in the sources top level directory (typically “<em>pyradio</em>”), you execute the command:</p>
<pre>sed -i 's/distro = None/distro = YOUR DISTRO NAME/' pyradio/config</pre>
<p>Then you go on to produce the package as you would normally do.</p>
<p>For example, an <strong>Arch Linux</strong> packager would use this command:</p>
<pre>sed -i 's/distro = None/distro = Arch Linux/' pyradio/config</pre>
<p>The distro name you insert here will appear in <strong>PyRadio</strong>’s “<em>Configuration Window</em>”. In addition to that it will appear in the log file, so that I know where the package came from while debugging.</p>
<p>Having said that, if you are not packaging for a specific distribution, please do use something meaningful (for example, using “<em>xxx</em>” will do the job, but provides no useful information).</p>
<h3 id="xdg-base-directory-specification-compliance">XDG Base Directory Specification Compliance</h3>
<p>By default, all <strong>PyRadio</strong> configuration, operational and state files are stored under “<em>~/.config/pyradio</em>”.</p>
<p><a target="_blank" href="https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG Base Directory Specification</a> proposes a different arrangement, though. More info (and examples) can also be found at Arch’s <a target="_blank" href="https://wiki.archlinux.org/title/XDG_Base_Directory">XDG Base Directory</a>.</p>
<p>If you want to comply to this specification, just execute the following command from the sources top level directory (typically “<em>pyradio</em>”):</p>
<pre>sed -i 's/xdg_compliant = False/xdg_compliant = True/' pyradio/config</pre>
<h3 id="desktop-notifications-optional">Desktop Notifications (optional)</h3>
<p>If you want to enable <a href="index.html#desktop-notifications">Desktop Notifications</a>, do a</p>
<pre>sed -i 's/enable_notifications = -1/enable_notifications = 0/' pyradio/config</pre>
<p>to display titles whenever they are received, or</p>
<pre>sed -i 's/enable_notifications = -1/enable_notifications = 60/' pyradio/config</pre>
<p>to have notifications every 60 seconds, for example. You can use any value here, starting from 30 to 300 (meaning every 30 seconds up to 5 minutes), using a step of 30.</p>
<h4 id="desktop-notification-icons-optional">Desktop Notification Icons (optional)</h4>
<p><strong>PyRadio</strong> will download stations logos (icons) in the “<em>logos</em>” cache directory.</p>
<p>This directory will be deleted at program exit, by default.</p>
<p>If you want to keep the downloaded icons, do a</p>
<pre>sed -i 's/remove_station_icons = True/remove_station_icons = False/' pyradio/config</pre>
<h3 id="desktop-file-location">Desktop File location</h3>
<p>If the Desktop File is not installed in <em>/usr/share/applications</em> or <em>/usr/local/share/applications</em>, it will have to be passed as a parameter to the script that will handle it, like so:</p>
<pre>sed -i "s,' -t ',' -d /path/to/desktop_file' + &," pyradio/main.py</pre>
<h3 id="pyradio__pycache__">pyradio/__pycache__</h3>
<p>This is a directory that is needed for some build systems to succesfully build <strong>PyRadio</strong>.</p>
<p>Depending on the build system:</p>
<ol type="1">
<li><p>It may be needed (in the case of Gentoo, MacOS and Windows).<br />
In this case, you have nothing to do.<br />
<br />
Please keep in mind that there is a REDME file in the directory; in case this file causes any problems, just remove the file before the build command.</p></li>
<li><p>It may not be needed (for example on Arch Linux).<br />
In this case, just delete it before the build command.</p></li>
</ol>
<h2 id="recordings-directory">Recordings Directory <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
<p>Parameter <strong>recording_dir</strong> in the config will point to the directory to save recorded files.</p>
<p>It may seem like a good idea to change it to something meaningful but there is a catch.</p>
<p><strong>PyRadio 0.9.3</strong> (and newer) will nornaly use the <em>default</em> location, which is <em><sub>/pyradio-recordings<em>. Furthermore, it will move the pre-0.9.3 default recordings dir, i.e. </em></sub>/.config/pyradio/recordings</em> and titles log(from <em>~/.config/pyradio</em>, to this new default location.</p>
<p>If you, the packager, provide a different default <strong>recording_dir</strong> in the package config file, your users will probably end up in the following situation:</p>
<ol type="1">
<li><p>Pro existing recordings and titles logs will end up in <em>~/pyradio-recordings</em>.</p></li>
<li><p>New recordings and titles logs will be saved in the new default location you have provided.</p></li>
</ol>
<p>This means that your users will eventaually have to <strong>manually</strong> move the files from <em>~/pyradio-recordings</em> to the new location.</p>
<p>If this is acceptable for you, and you have a way to inform your users about it, go no and</p>
<pre>sed -i 's|recording_dir = default|recording_dir = ~/whatever|' config</pre>
<p>In any other case, I would suggest you leave this parameter as is and let the user select customize their setup.</p>
<h2 id="mkvtoolnix-cli-installation">MKVToolNix cli installation <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
<p>Another thing to consider is whether you should mark <strong>MKVToolNix</strong> command line utilities as a dependency for <strong>PyRadio</strong>.</p>
<p>I would suggest to do so, in order to provide your users the best experience possible. If unsure, please refer to section <a href="recording.html#chapters">Chapters</a> in the relevant document.</p>
<p>In case you decide to do so, please make sure you mark as a dependency the <strong>command line utilities</strong>, not the GUI program, if that’s on a different package on your distro. For examle, Arch Linux provides both a <em>mkvtoolnix-cli</em> and a <em>mkvtoolnix-gui</em> package; the first one should be used. Same thing with Debian Linux; it provides both a <em>mkvtoolnix</em> and a <em>mkvtoolnix-gui</em> package; in which case you’d use the later.</p>
<h2 id="resource-opener-linux-only">Resource opener (Linux only) <span style="padding-left: 10px;"><sup style="font-size: 50%"><a href="#" title="Go to top of the page">Top</a></sup></span></h2>
<p>A <a target="_blank" href="https://wiki.archlinux.org/title/default_applications#Resource_openers">resource opener</a> is a utility to open directories, html pages, etc.</p>
<p><strong>PyRadio</strong> running on Linux will look for <em>xdg-open</em>, <em>gio</em>, <em>mimeopen</em>, <em>mimeo</em> or <em>handlr</em>, in that order of detection.</p>
<p>If none of the above if found, the requested file will simply not open.</p>
<p>Most Linux distros will probably have <em>xdg-open</em> (from <em>xdg-utils</em> package) installed or available (or any of the ones in the list above), so no action will be nesesary.</p>
<p>In case a different <em>resource opener</em> is to be used, one can declare it like so:</p>
<pre>sed -i 's/resource_opener = auto/resource_opener = MY_RESOURCE_OPENER/' config</pre>
<p>This will instruct <strong>PyRadio</strong> to use the file <strong>MY_RESOURCE_OPENER</strong> as a <em>resource opener</em>.</p>
<p><strong>MY_RESOURCE_OPENER</strong> can be just the name of the file (if it is in the <em>PATH</em>), or an absolute path to a file, it it’s not.</p>
</body>
</html>