]> pere.pagekite.me Git - homepage.git/blob - blog/index.rss
Generated.
[homepage.git] / blog / index.rss
1 <?xml version="1.0" encoding="utf-8"?>
2 <rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:atom="http://www.w3.org/2005/Atom">
3 <channel>
4 <title>Petter Reinholdtsen</title>
5 <description></description>
6 <link>http://people.skolelinux.org/pere/blog/</link>
7 <atom:link href="http://people.skolelinux.org/pere/blog/index.rss" rel="self" type="application/rss+xml" />
8
9 <item>
10 <title>Valutakrambod - A python and bitcoin love story</title>
11 <link>http://people.skolelinux.org/pere/blog/Valutakrambod___A_python_and_bitcoin_love_story.html</link>
12 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Valutakrambod___A_python_and_bitcoin_love_story.html</guid>
13 <pubDate>Sat, 29 Sep 2018 22:20:00 +0200</pubDate>
14 <description>&lt;p&gt;It would come as no surprise to anyone that I am interested in
15 bitcoins and virtual currencies. I&#39;ve been keeping an eye on virtual
16 currencies for many years, and it is part of the reason a few months
17 ago, I started writing a python library for collecting currency
18 exchange rates and trade on virtual currency exchanges. I decided to
19 name the end result valutakrambod, which perhaps can be translated to
20 small currency shop.&lt;/p&gt;
21
22 &lt;p&gt;The library uses the tornado python library to handle HTTP and
23 websocket connections, and provide a asynchronous system for
24 connecting to and tracking several services. The code is available
25 from
26 &lt;a href=&quot;http://github.com/petterreinholdtsen/valutakrambod&quot;&gt;github&lt;/a&gt;.&lt;/p&gt;
27
28 &lt;/p&gt;There are two example clients of the library. One is very simple and
29 list every updated buy/sell price received from the various services.
30 This code is started by running bin/btc-rates and call the client code
31 in valutakrambod/client.py. The simple client look like this:&lt;/p&gt;
32
33 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
34 import functools
35 import tornado.ioloop
36 import valutakrambod
37 class SimpleClient(object):
38 def __init__(self):
39 self.services = []
40 self.streams = []
41 pass
42 def newdata(self, service, pair, changed):
43 print(&quot;%-15s %s-%s: %8.3f %8.3f&quot; % (
44 service.servicename(),
45 pair[0],
46 pair[1],
47 service.rates[pair][&#39;ask&#39;],
48 service.rates[pair][&#39;bid&#39;])
49 )
50 async def refresh(self, service):
51 await service.fetchRates(service.wantedpairs)
52 def run(self):
53 self.ioloop = tornado.ioloop.IOLoop.current()
54 self.services = valutakrambod.service.knownServices()
55 for e in self.services:
56 service = e()
57 service.subscribe(self.newdata)
58 stream = service.websocket()
59 if stream:
60 self.streams.append(stream)
61 else:
62 # Fetch information from non-streaming services immediately
63 self.ioloop.call_later(len(self.services),
64 functools.partial(self.refresh, service))
65 # as well as regularly
66 service.periodicUpdate(60)
67 for stream in self.streams:
68 stream.connect()
69 try:
70 self.ioloop.start()
71 except KeyboardInterrupt:
72 print(&quot;Interrupted by keyboard, closing all connections.&quot;)
73 pass
74 for stream in self.streams:
75 stream.close()
76 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
77
78 &lt;p&gt;The library client loop over all known &quot;public&quot; services,
79 initialises it, subscribe to any updates from the service, check and
80 activate websocket streaming if the service provide it, and if no
81 streaming is supported, fetch information from the service and set up
82 a periodic update every 60 seconds. The output from this client can
83 look like this:&lt;/p&gt;
84
85 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
86 Bl3p BTC-EUR: 5687.110 5653.690
87 Bl3p BTC-EUR: 5687.110 5653.690
88 Bl3p BTC-EUR: 5687.110 5653.690
89 Hitbtc BTC-USD: 6594.560 6593.690
90 Hitbtc BTC-USD: 6594.560 6593.690
91 Bl3p BTC-EUR: 5687.110 5653.690
92 Hitbtc BTC-USD: 6594.570 6593.690
93 Bitstamp EUR-USD: 1.159 1.154
94 Hitbtc BTC-USD: 6594.570 6593.690
95 Hitbtc BTC-USD: 6594.580 6593.690
96 Hitbtc BTC-USD: 6594.580 6593.690
97 Hitbtc BTC-USD: 6594.580 6593.690
98 Bl3p BTC-EUR: 5687.110 5653.690
99 Paymium BTC-EUR: 5680.000 5620.240
100 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
101
102 &lt;p&gt;The exchange order book is tracked in addition to the best buy/sell
103 price, for those that need to know the details.&lt;/p&gt;
104
105 &lt;p&gt;The other example client is focusing on providing a curses view
106 with updated buy/sell prices as soon as they are received from the
107 services. This code is located in bin/btc-rates-curses and activated
108 by using the &#39;-c&#39; argument. Without the argument the &quot;curses&quot; output
109 is printed without using curses, which is useful for debugging. The
110 curses view look like this:&lt;/p&gt;
111
112 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
113 Name Pair Bid Ask Spr Ftcd Age
114 BitcoinsNorway BTCEUR 5591.8400 5711.0800 2.1% 16 nan 60
115 Bitfinex BTCEUR 5671.0000 5671.2000 0.0% 16 22 59
116 Bitmynt BTCEUR 5580.8000 5807.5200 3.9% 16 41 60
117 Bitpay BTCEUR 5663.2700 nan nan% 15 nan 60
118 Bitstamp BTCEUR 5664.8400 5676.5300 0.2% 0 1 1
119 Bl3p BTCEUR 5653.6900 5684.9400 0.5% 0 nan 19
120 Coinbase BTCEUR 5600.8200 5714.9000 2.0% 15 nan nan
121 Kraken BTCEUR 5670.1000 5670.2000 0.0% 14 17 60
122 Paymium BTCEUR 5620.0600 5680.0000 1.1% 1 7515 nan
123 BitcoinsNorway BTCNOK 52898.9700 54034.6100 2.1% 16 nan 60
124 Bitmynt BTCNOK 52960.3200 54031.1900 2.0% 16 41 60
125 Bitpay BTCNOK 53477.7833 nan nan% 16 nan 60
126 Coinbase BTCNOK 52990.3500 54063.0600 2.0% 15 nan nan
127 MiraiEx BTCNOK 52856.5300 54100.6000 2.3% 16 nan nan
128 BitcoinsNorway BTCUSD 6495.5300 6631.5400 2.1% 16 nan 60
129 Bitfinex BTCUSD 6590.6000 6590.7000 0.0% 16 23 57
130 Bitpay BTCUSD 6564.1300 nan nan% 15 nan 60
131 Bitstamp BTCUSD 6561.1400 6565.6200 0.1% 0 2 1
132 Coinbase BTCUSD 6504.0600 6635.9700 2.0% 14 nan 117
133 Gemini BTCUSD 6567.1300 6573.0700 0.1% 16 89 nan
134 Hitbtc+BTCUSD 6592.6200 6594.2100 0.0% 0 0 0
135 Kraken BTCUSD 6565.2000 6570.9000 0.1% 15 17 58
136 Exchangerates EURNOK 9.4665 9.4665 0.0% 16 107789 nan
137 Norgesbank EURNOK 9.4665 9.4665 0.0% 16 107789 nan
138 Bitstamp EURUSD 1.1537 1.1593 0.5% 4 5 1
139 Exchangerates EURUSD 1.1576 1.1576 0.0% 16 107789 nan
140 BitcoinsNorway LTCEUR 1.0000 49.0000 98.0% 16 nan nan
141 BitcoinsNorway LTCNOK 492.4800 503.7500 2.2% 16 nan 60
142 BitcoinsNorway LTCUSD 1.0221 49.0000 97.9% 15 nan nan
143 Norgesbank USDNOK 8.1777 8.1777 0.0% 16 107789 nan
144 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
145
146 &lt;p&gt;The code for this client is too complex for a simple blog post, so
147 you will have to check out the git repository to figure out how it
148 work. What I can tell is how the three last numbers on each line
149 should be interpreted. The first is how many seconds ago information
150 was received from the service. The second is how long ago, according
151 to the service, the provided information was updated. The last is an
152 estimate on how often the buy/sell values change.&lt;/p&gt;
153
154 &lt;p&gt;If you find this library useful, or would like to improve it, I
155 would love to hear from you. Note that for some of the services I&#39;ve
156 implemented a trading API. It might be the topic of a future blog
157 post.&lt;/p&gt;
158
159 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
160 activities, please send Bitcoin donations to my address
161 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
162 </description>
163 </item>
164
165 <item>
166 <title>VLC in Debian now can do bittorrent streaming</title>
167 <link>http://people.skolelinux.org/pere/blog/VLC_in_Debian_now_can_do_bittorrent_streaming.html</link>
168 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/VLC_in_Debian_now_can_do_bittorrent_streaming.html</guid>
169 <pubDate>Mon, 24 Sep 2018 21:20:00 +0200</pubDate>
170 <description>&lt;p&gt;Back in February, I got curious to see
171 &lt;a href=&quot;http://people.skolelinux.org/pere/blog/Using_VLC_to_stream_bittorrent_sources.html&quot;&gt;if
172 VLC now supported Bittorrent streaming&lt;/a&gt;. It did not, despite the
173 fact that the idea and code to handle such streaming had been floating
174 around for years. I did however find
175 &lt;a href=&quot;https://github.com/johang/vlc-bittorrent&quot;&gt;a standalone plugin
176 for VLC&lt;/a&gt; to do it, and half a year later I decided to wrap up the
177 plugin and get it into Debian. I uploaded it to NEW a few days ago,
178 and am very happy to report that it
179 &lt;a href=&quot;https://tracker.debian.org/pkg/vlc-plugin-bittorrent&quot;&gt;entered
180 Debian&lt;/a&gt; a few hours ago, and should be available in Debian/Unstable
181 tomorrow, and Debian/Testing in a few days.&lt;/p&gt;
182
183 &lt;p&gt;With the vlc-plugin-bittorrent package installed you should be able
184 to stream videos using a simple call to&lt;/p&gt;
185
186 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
187 vlc https://archive.org/download/TheGoat/TheGoat_archive.torrent
188 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
189
190 &lt;/p&gt;It can handle magnet links too. Now if only native vlc had
191 bittorrent support. Then a lot more would be helping each other to
192 share public domain and creative commons movies. The plugin need some
193 stability work with seeking and picking the right file in a torrent
194 with many files, but is already usable. Please note that the plugin
195 is not removing downloaded files when vlc is stopped, so it can fill
196 up your disk if you are not careful. Have fun. :)&lt;/p&gt;
197
198 &lt;p&gt;I would love to get help maintaining this package. Get in touch if
199 you are interested.&lt;/p&gt;
200
201 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
202 activities, please send Bitcoin donations to my address
203 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
204 </description>
205 </item>
206
207 <item>
208 <title>Using the Kodi API to play Youtube videos</title>
209 <link>http://people.skolelinux.org/pere/blog/Using_the_Kodi_API_to_play_Youtube_videos.html</link>
210 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Using_the_Kodi_API_to_play_Youtube_videos.html</guid>
211 <pubDate>Sun, 2 Sep 2018 23:40:00 +0200</pubDate>
212 <description>&lt;p&gt;I continue to explore my Kodi installation, and today I wanted to
213 tell it to play a youtube URL I received in a chat, without having to
214 insert search terms using the on-screen keyboard. After searching the
215 web for API access to the Youtube plugin and testing a bit, I managed
216 to find a recipe that worked. If you got a kodi instance with its API
217 available from http://kodihost/jsonrpc, you can try the following to
218 have check out a nice cover band.&lt;/p&gt;
219
220 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;curl --silent --header &#39;Content-Type: application/json&#39; \
221 --data-binary &#39;{ &quot;id&quot;: 1, &quot;jsonrpc&quot;: &quot;2.0&quot;, &quot;method&quot;: &quot;Player.Open&quot;,
222 &quot;params&quot;: {&quot;item&quot;: { &quot;file&quot;:
223 &quot;plugin://plugin.video.youtube/play/?video_id=LuRGVM9O0qg&quot; } } }&#39; \
224 http://projector.local/jsonrpc&lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
225
226 &lt;p&gt;I&#39;ve extended kodi-stream program to take a video source as its
227 first argument. It can now handle direct video links, youtube links
228 and &#39;desktop&#39; to stream my desktop to Kodi. It is almost like a
229 Chromecast. :)&lt;/p&gt;
230
231 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
232 activities, please send Bitcoin donations to my address
233 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
234 </description>
235 </item>
236
237 <item>
238 <title>Software created using taxpayers’ money should be Free Software</title>
239 <link>http://people.skolelinux.org/pere/blog/Software_created_using_taxpayers__money_should_be_Free_Software.html</link>
240 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Software_created_using_taxpayers__money_should_be_Free_Software.html</guid>
241 <pubDate>Thu, 30 Aug 2018 13:50:00 +0200</pubDate>
242 <description>&lt;p&gt;It might seem obvious that software created using tax money should
243 be available for everyone to use and improve. Free Software
244 Foundation Europe recentlystarted a campaign to help get more people
245 to understand this, and I just signed the petition on
246 &lt;a href=&quot;https://publiccode.eu/&quot;&gt;Public Money, Public Code&lt;/a&gt; to help
247 them. I hope you too will do the same.&lt;/p&gt;
248 </description>
249 </item>
250
251 <item>
252 <title>A bit more on privacy respecting health monitor / fitness tracker</title>
253 <link>http://people.skolelinux.org/pere/blog/A_bit_more_on_privacy_respecting_health_monitor___fitness_tracker.html</link>
254 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/A_bit_more_on_privacy_respecting_health_monitor___fitness_tracker.html</guid>
255 <pubDate>Mon, 13 Aug 2018 09:00:00 +0200</pubDate>
256 <description>&lt;p&gt;A few days ago, I wondered if there are any privacy respecting
257 health monitors and/or fitness trackers available for sale these days.
258 I would like to buy one, but do not want to share my personal data
259 with strangers, nor be forced to have a mobile phone to get data out
260 of the unit. I&#39;ve received some ideas, and would like to share them
261 with you.
262
263 One interesting data point was a pointer to a Free Software app for
264 Android named
265 &lt;a href=&quot;https://github.com/Freeyourgadget/Gadgetbridge/&quot;&gt;Gadgetbridge&lt;/a&gt;.
266 It provide cloudless collection and storing of data from a variety of
267 trackers. Its
268 &lt;a href=&quot;https://github.com/Freeyourgadget/Gadgetbridge/#supported-devices&quot;&gt;list
269 of supported devices&lt;/a&gt; is a good indicator for units where the
270 protocol is fairly open, as it is obviously being handled by Free
271 Software. Other units are reportedly encrypting the collected
272 information with their own public key, making sure only the vendor
273 cloud service is able to extract data from the unit. The people
274 contacting me about Gadgetbirde said they were using
275 &lt;a href=&quot;https://us.amazfit.com/shop/bip?variant=336750&quot;&gt;Amazfit
276 Bip&lt;/a&gt; and
277 &lt;a href=&quot;http://www.xiaomimi6phone.com/xiaomi-mi-band-3-features-release-date-rumors/&quot;&gt;Xiaomi
278 Band 3&lt;/a&gt;.&lt;/p&gt;
279
280 &lt;p&gt;I also got a suggestion to look at some of the units from Garmin.
281 I was told their GPS watches can be connected via USB and show up as a
282 USB storage device with
283 &lt;a href=&quot;https://www.gpsbabel.org/htmldoc-development/fmt_garmin_fit.html&quot;&gt;Garmin
284 FIT files&lt;/a&gt; containing the collected measurements. While
285 proprietary, FIT files apparently can be read at least by
286 &lt;a href=&quot;https://www.gpsbabel.org&quot;&gt;GPSBabel&lt;/a&gt; and the
287 &lt;a href=&quot;https://apps.nextcloud.com/apps/gpxpod&quot;&gt;GpxPod&lt;/a&gt; Nextcloud
288 app. It is unclear to me if they can read step count and heart rate
289 data. The person I talked to was using a
290 &lt;a href=&quot;https://buy.garmin.com/en-US/US/p/564291&quot;&gt;Garmin Forerunner
291 935&lt;/a&gt;, which is a fairly expensive unit. I doubt it is worth it for
292 a unit where the vendor clearly is trying its best to move from open
293 to closed systems. I still remember when Garmin dropped NMEA support
294 in its GPSes.&lt;/p&gt;
295
296 &lt;p&gt;A final idea was to build ones own unit, perhaps by basing it on a
297 wearable hardware platforms like
298 &lt;a href=&quot;https://learn.adafruit.com/flora-geo-watch&quot;&gt;the Flora Geo
299 Watch&lt;/a&gt;. Sound like fun, but I had more money than time to spend on
300 the topic, so I suspect it will have to wait for another time.&lt;/p&gt;
301
302 &lt;p&gt;While I was working on tracking down links, I came across an
303 inspiring TED talk by Dave Debronkart about
304 &lt;a href=&quot;https://archive.org/details/DavedeBronkart_2010X&quot;&gt;being a
305 e-patient&lt;/a&gt;, and discovered the web site
306 &lt;a href=&quot;https://participatorymedicine.org/epatients/&quot;&gt;Participatory
307 Medicine&lt;/a&gt;. If you too want to track your own health and fitness
308 without having information about your private life floating around on
309 computers owned by others, I recommend checking it out.&lt;/p&gt;
310
311 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
312 activities, please send Bitcoin donations to my address
313 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
314 </description>
315 </item>
316
317 <item>
318 <title>Privacy respecting health monitor / fitness tracker?</title>
319 <link>http://people.skolelinux.org/pere/blog/Privacy_respecting_health_monitor___fitness_tracker_.html</link>
320 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Privacy_respecting_health_monitor___fitness_tracker_.html</guid>
321 <pubDate>Tue, 7 Aug 2018 16:00:00 +0200</pubDate>
322 <description>&lt;p&gt;Dear lazyweb,&lt;/p&gt;
323
324 &lt;p&gt;I wonder, is there a fitness tracker / health monitor available for
325 sale today that respect the users privacy? With this I mean a
326 watch/bracelet capable of measuring pulse rate and other
327 fitness/health related values (and by all means, also the correct time
328 and location if possible), which is &lt;strong&gt;only&lt;/strong&gt; provided for
329 me to extract/read from the unit with computer without a radio beacon
330 and Internet connection. In other words, it do not depend on a cell
331 phone app, and do make the measurements available via other peoples
332 computer (aka &quot;the cloud&quot;). The collected data should be available
333 using only free software. I&#39;m not interested in depending on some
334 non-free software that will leave me high and dry some time in the
335 future. I&#39;ve been unable to find any such unit. I would like to buy
336 it. The ones I have seen for sale here in Norway are proud to report
337 that they share my health data with strangers (aka &quot;cloud enabled&quot;).
338 Is there an alternative? I&#39;m not interested in giving money to people
339 requiring me to accept &quot;privacy terms&quot; to allow myself to measure my
340 own health.&lt;/p&gt;
341
342 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
343 activities, please send Bitcoin donations to my address
344 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
345 </description>
346 </item>
347
348 <item>
349 <title>Sharing images with friends and family using RSS and EXIF/XMP metadata</title>
350 <link>http://people.skolelinux.org/pere/blog/Sharing_images_with_friends_and_family_using_RSS_and_EXIF_XMP_metadata.html</link>
351 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Sharing_images_with_friends_and_family_using_RSS_and_EXIF_XMP_metadata.html</guid>
352 <pubDate>Tue, 31 Jul 2018 23:30:00 +0200</pubDate>
353 <description>&lt;p&gt;For a while now, I have looked for a sensible way to share images
354 with my family using a self hosted solution, as it is unacceptable to
355 place images from my personal life under the control of strangers
356 working for data hoarders like Google or Dropbox. The last few days I
357 have drafted an approach that might work out, and I would like to
358 share it with you. I would like to publish images on a server under
359 my control, and point some Internet connected display units using some
360 free and open standard to the images I published. As my primary
361 language is not limited to ASCII, I need to store metadata using
362 UTF-8. Many years ago, I hoped to find a digital photo frame capable
363 of reading a RSS feed with image references (aka using the
364 &amp;lt;enclosure&amp;gt; RSS tag), but was unable to find a current supplier
365 of such frames. In the end I gave up that approach.&lt;/p&gt;
366
367 &lt;p&gt;Some months ago, I discovered that
368 &lt;a href=&quot;https://www.jwz.org/xscreensaver/&quot;&gt;XScreensaver&lt;/a&gt; is able to
369 read images from a RSS feed, and used it to set up a screen saver on
370 my home info screen, showing images from the Daily images feed from
371 NASA. This proved to work well. More recently I discovered that
372 &lt;a href=&quot;https://kodi.tv&quot;&gt;Kodi&lt;/a&gt; (both using
373 &lt;a href=&quot;https://www.openelec.tv/&quot;&gt;OpenELEC&lt;/a&gt; and
374 &lt;a href=&quot;https://libreelec.tv&quot;&gt;LibreELEC&lt;/a&gt;) provide the
375 &lt;a href=&quot;https://github.com/grinsted/script.screensaver.feedreader&quot;&gt;Feedreader&lt;/a&gt;
376 screen saver capable of reading a RSS feed with images and news. For
377 fun, I used it this summer to test Kodi on my parents TV by hooking up
378 a Raspberry PI unit with LibreELEC, and wanted to provide them with a
379 screen saver showing selected pictures from my selection.&lt;/p&gt;
380
381 &lt;p&gt;Armed with motivation and a test photo frame, I set out to generate
382 a RSS feed for the Kodi instance. I adjusted my &lt;a
383 href=&quot;https://freedombox.org/&quot;&gt;Freedombox&lt;/a&gt; instance, created
384 /var/www/html/privatepictures/, wrote a small Perl script to extract
385 title and description metadata from the photo files and generate the
386 RSS file. I ended up using Perl instead of python, as the
387 libimage-exiftool-perl Debian package seemed to handle the EXIF/XMP
388 tags I ended up using, while python3-exif did not. The relevant EXIF
389 tags only support ASCII, so I had to find better alternatives. XMP
390 seem to have the support I need.&lt;/p&gt;
391
392 &lt;p&gt;I am a bit unsure which EXIF/XMP tags to use, as I would like to
393 use tags that can be easily added/updated using normal free software
394 photo managing software. I ended up using the tags set using this
395 exiftool command, as these tags can also be set using digiKam:&lt;/p&gt;
396
397 &lt;blockquote&gt;&lt;pre&gt;
398 exiftool -headline=&#39;The RSS image title&#39; \
399 -description=&#39;The RSS image description.&#39; \
400 -subject+=for-family photo.jpeg
401 &lt;/pre&gt;&lt;/blockquote&gt;
402
403 &lt;p&gt;I initially tried the &quot;-title&quot; and &quot;keyword&quot; tags, but they were
404 invisible in digiKam, so I changed to &quot;-headline&quot; and &quot;-subject&quot;. I
405 use the keyword/subject &#39;for-family&#39; to flag that the photo should be
406 shared with my family. Images with this keyword set are located and
407 copied into my Freedombox for the RSS generating script to find.&lt;/p&gt;
408
409 &lt;p&gt;Are there better ways to do this? Get in touch if you have better
410 suggestions.&lt;/p&gt;
411
412 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
413 activities, please send Bitcoin donations to my address
414 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
415 </description>
416 </item>
417
418 <item>
419 <title>Simple streaming the Linux desktop to Kodi using GStreamer and RTP</title>
420 <link>http://people.skolelinux.org/pere/blog/Simple_streaming_the_Linux_desktop_to_Kodi_using_GStreamer_and_RTP.html</link>
421 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Simple_streaming_the_Linux_desktop_to_Kodi_using_GStreamer_and_RTP.html</guid>
422 <pubDate>Thu, 12 Jul 2018 17:55:00 +0200</pubDate>
423 <description>&lt;p&gt;Last night, I wrote
424 &lt;a href=&quot;http://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html&quot;&gt;a
425 recipe to stream a Linux desktop using VLC to a instance of Kodi&lt;/a&gt;.
426 During the day I received valuable feedback, and thanks to the
427 suggestions I have been able to rewrite the recipe into a much simpler
428 approach requiring no setup at all. It is a single script that take
429 care of it all.&lt;/p&gt;
430
431 &lt;p&gt;This new script uses GStreamer instead of VLC to capture the
432 desktop and stream it to Kodi. This fixed the video quality issue I
433 saw initially. It further removes the need to add a m3u file on the
434 Kodi machine, as it instead connects to
435 &lt;a href=&quot;https://kodi.wiki/view/JSON-RPC_API/v8&quot;&gt;the JSON-RPC API in
436 Kodi&lt;/a&gt; and simply ask Kodi to play from the stream created using
437 GStreamer. Streaming the desktop to Kodi now become trivial. Copy
438 the script below, run it with the DNS name or IP address of the kodi
439 server to stream to as the only argument, and watch your screen show
440 up on the Kodi screen. Note, it depend on multicast on the local
441 network, so if you need to stream outside the local network, the
442 script must be modified. Also note, I have no idea if audio work, as
443 I only care about the picture part.&lt;/p&gt;
444
445 &lt;blockquote&gt;&lt;pre&gt;
446 #!/bin/sh
447 #
448 # Stream the Linux desktop view to Kodi. See
449 # http://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html
450 # for backgorund information.
451
452 # Make sure the stream is stopped in Kodi and the gstreamer process is
453 # killed if something go wrong (for example if curl is unable to find the
454 # kodi server). Do the same when interrupting this script.
455 kodicmd() {
456 host=&quot;$1&quot;
457 cmd=&quot;$2&quot;
458 params=&quot;$3&quot;
459 curl --silent --header &#39;Content-Type: application/json&#39; \
460 --data-binary &quot;{ \&quot;id\&quot;: 1, \&quot;jsonrpc\&quot;: \&quot;2.0\&quot;, \&quot;method\&quot;: \&quot;$cmd\&quot;, \&quot;params\&quot;: $params }&quot; \
461 &quot;http://$host/jsonrpc&quot;
462 }
463 cleanup() {
464 if [ -n &quot;$kodihost&quot; ] ; then
465 # Stop the playing when we end
466 playerid=$(kodicmd &quot;$kodihost&quot; Player.GetActivePlayers &quot;{}&quot; |
467 jq .result[].playerid)
468 kodicmd &quot;$kodihost&quot; Player.Stop &quot;{ \&quot;playerid\&quot; : $playerid }&quot; &gt; /dev/null
469 fi
470 if [ &quot;$gstpid&quot; ] &amp;&amp; kill -0 &quot;$gstpid&quot; &gt;/dev/null 2&gt;&amp;1; then
471 kill &quot;$gstpid&quot;
472 fi
473 }
474 trap cleanup EXIT INT
475
476 if [ -n &quot;$1&quot; ]; then
477 kodihost=$1
478 shift
479 else
480 kodihost=kodi.local
481 fi
482
483 mcast=239.255.0.1
484 mcastport=1234
485 mcastttl=1
486
487 pasrc=$(pactl list | grep -A2 &#39;Source #&#39; | grep &#39;Name: .*\.monitor$&#39; | \
488 cut -d&quot; &quot; -f2|head -1)
489 gst-launch-1.0 ximagesrc use-damage=0 ! video/x-raw,framerate=30/1 ! \
490 videoconvert ! queue2 ! \
491 x264enc bitrate=8000 speed-preset=superfast tune=zerolatency qp-min=30 \
492 key-int-max=15 bframes=2 ! video/x-h264,profile=high ! queue2 ! \
493 mpegtsmux alignment=7 name=mux ! rndbuffersize max=1316 min=1316 ! \
494 udpsink host=$mcast port=$mcastport ttl-mc=$mcastttl auto-multicast=1 sync=0 \
495 pulsesrc device=$pasrc ! audioconvert ! queue2 ! avenc_aac ! queue2 ! mux. \
496 &gt; /dev/null 2&gt;&amp;1 &amp;
497 gstpid=$!
498
499 # Give stream a second to get going
500 sleep 1
501
502 # Ask kodi to start streaming using its JSON-RPC API
503 kodicmd &quot;$kodihost&quot; Player.Open \
504 &quot;{\&quot;item\&quot;: { \&quot;file\&quot;: \&quot;udp://@$mcast:$mcastport\&quot; } }&quot; &gt; /dev/null
505
506 # wait for gst to end
507 wait &quot;$gstpid&quot;
508 &lt;/pre&gt;&lt;/blockquote&gt;
509
510 &lt;p&gt;I hope you find the approach useful. I know I do.&lt;/p&gt;
511
512 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
513 activities, please send Bitcoin donations to my address
514 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
515 </description>
516 </item>
517
518 <item>
519 <title>Streaming the Linux desktop to Kodi using VLC and RTSP</title>
520 <link>http://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html</link>
521 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/Streaming_the_Linux_desktop_to_Kodi_using_VLC_and_RTSP.html</guid>
522 <pubDate>Thu, 12 Jul 2018 02:00:00 +0200</pubDate>
523 <description>&lt;p&gt;PS: See
524 &lt;ahref=&quot;http://people.skolelinux.org/pere/blog/Simple_streaming_the_Linux_desktop_to_Kodi_using_GStreamer_and_RTP.html&quot;&gt;the
525 followup post&lt;/a&gt; for a even better approach.&lt;/p&gt;
526
527 &lt;p&gt;A while back, I was asked by a friend how to stream the desktop to
528 my projector connected to Kodi. I sadly had to admit that I had no
529 idea, as it was a task I never had tried. Since then, I have been
530 looking for a way to do so, preferable without much extra software to
531 install on either side. Today I found a way that seem to kind of
532 work. Not great, but it is a start.&lt;/p&gt;
533
534 &lt;p&gt;I had a look at several approaches, for example
535 &lt;a href=&quot;https://github.com/mfoetsch/dlna_live_streaming&quot;&gt;using uPnP
536 DLNA as described in 2011&lt;/a&gt;, but it required a uPnP server, fuse and
537 local storage enough to store the stream locally. This is not going
538 to work well for me, lacking enough free space, and it would
539 impossible for my friend to get working.&lt;/p&gt;
540
541 &lt;p&gt;Next, it occurred to me that perhaps I could use VLC to create a
542 video stream that Kodi could play. Preferably using
543 broadcast/multicast, to avoid having to change any setup on the Kodi
544 side when starting such stream. Unfortunately, the only recipe I
545 could find using multicast used the rtp protocol, and this protocol
546 seem to not be supported by Kodi.&lt;/p&gt;
547
548 &lt;p&gt;On the other hand, the rtsp protocol is working! Unfortunately I
549 have to specify the IP address of the streaming machine in both the
550 sending command and the file on the Kodi server. But it is showing my
551 desktop, and thus allow us to have a shared look on the big screen at
552 the programs I work on.&lt;/p&gt;
553
554 &lt;p&gt;I did not spend much time investigating codeces. I combined the
555 rtp and rtsp recipes from
556 &lt;a href=&quot;https://wiki.videolan.org/Documentation:Streaming_HowTo/Command_Line_Examples/&quot;&gt;the
557 VLC Streaming HowTo/Command Line Examples&lt;/a&gt;, and was able to get
558 this working on the desktop/streaming end.&lt;/p&gt;
559
560 &lt;blockquote&gt;&lt;pre&gt;
561 vlc screen:// --sout \
562 &#39;#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128}:rtp{dst=projector.local,port=1234,sdp=rtsp://192.168.11.4:8080/test.sdp}&#39;
563 &lt;/pre&gt;&lt;/blockquote&gt;
564
565 &lt;p&gt;I ssh-ed into my Kodi box and created a file like this with the
566 same IP address:&lt;/p&gt;
567
568 &lt;blockquote&gt;&lt;pre&gt;
569 echo rtsp://192.168.11.4:8080/test.sdp \
570 &gt; /storage/videos/screenstream.m3u
571 &lt;/pre&gt;&lt;/blockquote&gt;
572
573 &lt;p&gt;Note the 192.168.11.4 IP address is my desktops IP address. As far
574 as I can tell the IP must be hardcoded for this to work. In other
575 words, if someone elses machine is going to do the steaming, you have
576 to update screenstream.m3u on the Kodi machine and adjust the vlc
577 recipe. To get started, locate the file in Kodi and select the m3u
578 file while the VLC stream is running. The desktop then show up in my
579 big screen. :)&lt;/p&gt;
580
581 &lt;p&gt;When using the same technique to stream a video file with audio,
582 the audio quality is really bad. No idea if the problem is package
583 loss or bad parameters for the transcode. I do not know VLC nor Kodi
584 enough to tell.&lt;/p&gt;
585
586 &lt;p&gt;&lt;strong&gt;Update 2018-07-12&lt;/strong&gt;: Johannes Schauer send me a few
587 succestions and reminded me about an important step. The &quot;screen:&quot;
588 input source is only available once the vlc-plugin-access-extra
589 package is installed on Debian. Without it, you will see this error
590 message: &quot;VLC is unable to open the MRL &#39;screen://&#39;. Check the log
591 for details.&quot; He further found that it is possible to drop some parts
592 of the VLC command line to reduce the amount of hardcoded information.
593 It is also useful to consider using cvlc to avoid having the VLC
594 window in the desktop view. In sum, this give us this command line on
595 the source end
596
597 &lt;blockquote&gt;&lt;pre&gt;
598 cvlc screen:// --sout \
599 &#39;#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128}:rtp{sdp=rtsp://:8080/}&#39;
600 &lt;/pre&gt;&lt;/blockquote&gt;
601
602 &lt;p&gt;and this on the Kodi end&lt;p&gt;
603
604 &lt;blockquote&gt;&lt;pre&gt;
605 echo rtsp://192.168.11.4:8080/ \
606 &gt; /storage/videos/screenstream.m3u
607 &lt;/pre&gt;&lt;/blockquote&gt;
608
609 &lt;p&gt;Still bad image quality, though. But I did discover that streaming
610 a DVD using dvdsimple:///dev/dvd as the source had excellent video and
611 audio quality, so I guess the issue is in the input or transcoding
612 parts, not the rtsp part. I&#39;ve tried to change the vb and ab
613 parameters to use more bandwidth, but it did not make a
614 difference.&lt;/p&gt;
615
616 &lt;p&gt;I further received a suggestion from Einar Haraldseid to try using
617 gstreamer instead of VLC, and this proved to work great! He also
618 provided me with the trick to get Kodi to use a multicast stream as
619 its source. By using this monstrous oneliner, I can stream my desktop
620 with good video quality in reasonable framerate to the 239.255.0.1
621 multicast address on port 1234:
622
623 &lt;blockquote&gt;&lt;pre&gt;
624 gst-launch-1.0 ximagesrc use-damage=0 ! video/x-raw,framerate=30/1 ! \
625 videoconvert ! queue2 ! \
626 x264enc bitrate=8000 speed-preset=superfast tune=zerolatency qp-min=30 \
627 key-int-max=15 bframes=2 ! video/x-h264,profile=high ! queue2 ! \
628 mpegtsmux alignment=7 name=mux ! rndbuffersize max=1316 min=1316 ! \
629 udpsink host=239.255.0.1 port=1234 ttl-mc=1 auto-multicast=1 sync=0 \
630 pulsesrc device=$(pactl list | grep -A2 &#39;Source #&#39; | \
631 grep &#39;Name: .*\.monitor$&#39; | cut -d&quot; &quot; -f2|head -1) ! \
632 audioconvert ! queue2 ! avenc_aac ! queue2 ! mux.
633 &lt;/pre&gt;&lt;/blockquote&gt;
634
635 &lt;p&gt;and this on the Kodi end&lt;p&gt;
636
637 &lt;blockquote&gt;&lt;pre&gt;
638 echo udp://@239.255.0.1:1234 \
639 &gt; /storage/videos/screenstream.m3u
640 &lt;/pre&gt;&lt;/blockquote&gt;
641
642 &lt;p&gt;Note the trick to pick a valid pulseaudio source. It might not
643 pick the one you need. This approach will of course lead to trouble
644 if more than one source uses the same multicast port and address.
645 Note the ttl-mc=1 setting, which limit the multicast packages to the
646 local network. If the value is increased, your screen will be
647 broadcasted further, one network &quot;hop&quot; for each increase (read up on
648 multicast to learn more. :)!&lt;/p&gt;
649
650 &lt;p&gt;Having cracked how to get Kodi to receive multicast streams, I
651 could use this VLC command to stream to the same multicast address.
652 The image quality is way better than the rtsp approach, but gstreamer
653 seem to be doing a better job.&lt;/p&gt;
654
655 &lt;blockquote&gt;&lt;pre&gt;
656 cvlc screen:// --sout &#39;#transcode{vcodec=mp4v,acodec=mpga,vb=800,ab=128}:rtp{mux=ts,dst=239.255.0.1,port=1234,sdp=sap}&#39;
657 &lt;/pre&gt;&lt;/blockquote&gt;
658
659 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
660 activities, please send Bitcoin donations to my address
661 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
662 </description>
663 </item>
664
665 <item>
666 <title>What is the most supported MIME type in Debian in 2018?</title>
667 <link>http://people.skolelinux.org/pere/blog/What_is_the_most_supported_MIME_type_in_Debian_in_2018_.html</link>
668 <guid isPermaLink="true">http://people.skolelinux.org/pere/blog/What_is_the_most_supported_MIME_type_in_Debian_in_2018_.html</guid>
669 <pubDate>Mon, 9 Jul 2018 08:05:00 +0200</pubDate>
670 <description>&lt;p&gt;Five years ago,
671 &lt;a href=&quot;http://people.skolelinux.org/pere/blog/What_is_the_most_supported_MIME_type_in_Debian_.html&quot;&gt;I
672 measured what the most supported MIME type in Debian was&lt;/a&gt;, by
673 analysing the desktop files in all packages in the archive. Since
674 then, the DEP-11 AppStream system has been put into production, making
675 the task a lot easier. This made me want to repeat the measurement,
676 to see how much things changed. Here are the new numbers, for
677 unstable only this time:
678
679 &lt;p&gt;&lt;strong&gt;Debian Unstable:&lt;/strong&gt;&lt;/p&gt;
680
681 &lt;pre&gt;
682 count MIME type
683 ----- -----------------------
684 56 image/jpeg
685 55 image/png
686 49 image/tiff
687 48 image/gif
688 39 image/bmp
689 38 text/plain
690 37 audio/mpeg
691 34 application/ogg
692 33 audio/x-flac
693 32 audio/x-mp3
694 30 audio/x-wav
695 30 audio/x-vorbis+ogg
696 29 image/x-portable-pixmap
697 27 inode/directory
698 27 image/x-portable-bitmap
699 27 audio/x-mpeg
700 26 application/x-ogg
701 25 audio/x-mpegurl
702 25 audio/ogg
703 24 text/html
704 &lt;/pre&gt;
705
706 &lt;p&gt;The list was created like this using a sid chroot: &quot;cat
707 /var/lib/apt/lists/*sid*_dep11_Components-amd64.yml.gz| zcat | awk &#39;/^
708 - \S+\/\S+$/ {print $2 }&#39; | sort | uniq -c | sort -nr | head -20&quot;&lt;/p&gt;
709
710 &lt;p&gt;It is interesting to see how image formats have passed text/plain
711 as the most announced supported MIME type. These days, thanks to the
712 AppStream system, if you run into a file format you do not know, and
713 want to figure out which packages support the format, you can find the
714 MIME type of the file using &quot;file --mime &amp;lt;filename&amp;gt;&quot;, and then
715 look up all packages announcing support for this format in their
716 AppStream metadata (XML or .desktop file) using &quot;appstreamcli
717 what-provides mimetype &amp;lt;mime-type&amp;gt;. For example if you, like
718 me, want to know which packages support inode/directory, you can get a
719 list like this:&lt;/p&gt;
720
721 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
722 % appstreamcli what-provides mimetype inode/directory | grep Package: | sort
723 Package: anjuta
724 Package: audacious
725 Package: baobab
726 Package: cervisia
727 Package: chirp
728 Package: dolphin
729 Package: doublecmd-common
730 Package: easytag
731 Package: enlightenment
732 Package: ephoto
733 Package: filelight
734 Package: gwenview
735 Package: k4dirstat
736 Package: kaffeine
737 Package: kdesvn
738 Package: kid3
739 Package: kid3-qt
740 Package: nautilus
741 Package: nemo
742 Package: pcmanfm
743 Package: pcmanfm-qt
744 Package: qweborf
745 Package: ranger
746 Package: sirikali
747 Package: spacefm
748 Package: spacefm
749 Package: vifm
750 %
751 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
752
753 &lt;p&gt;Using the same method, I can quickly discover that the Sketchup file
754 format is not yet supported by any package in Debian:&lt;/p&gt;
755
756 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
757 % appstreamcli what-provides mimetype application/vnd.sketchup.skp
758 Could not find component providing &#39;mimetype::application/vnd.sketchup.skp&#39;.
759 %
760 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
761
762 &lt;p&gt;Yesterday I used it to figure out which packages support the STL 3D
763 format:&lt;/p&gt;
764
765 &lt;p&gt;&lt;blockquote&gt;&lt;pre&gt;
766 % appstreamcli what-provides mimetype application/sla|grep Package
767 Package: cura
768 Package: meshlab
769 Package: printrun
770 %
771 &lt;/pre&gt;&lt;/blockquote&gt;&lt;/p&gt;
772
773 &lt;p&gt;PS: A new version of Cura was uploaded to Debian yesterday.&lt;/p&gt;
774
775 &lt;p&gt;As usual, if you use Bitcoin and want to show your support of my
776 activities, please send Bitcoin donations to my address
777 &lt;b&gt;&lt;a href=&quot;bitcoin:15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&quot;&gt;15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b&lt;/a&gt;&lt;/b&gt;.&lt;/p&gt;
778 </description>
779 </item>
780
781 </channel>
782 </rss>