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">
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" />
10 <title>New and improved Frikanalen Kodi addon version
0.0.3</title>
11 <link>http://people.skolelinux.org/pere/blog/New_and_improved_Frikanalen_Kodi_addon_version_0_0_3.html
</link>
12 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/New_and_improved_Frikanalen_Kodi_addon_version_0_0_3.html
</guid>
13 <pubDate>Thu,
8 Nov
2018 10:
30:
00 +
0100</pubDate>
14 <description><p
>If you read my blog regularly, you probably know I am involved in
15 running and developing the
<a href=
"https://frikanalen.no/
">Norwegian
16 TV channel Frikanalen
</a
>. It is an open channel, allowing everyone
17 in Norway to publish videos on a TV channel with national coverage.
18 You can think of it as Youtube for national television.
19 In addition to distribution on RiksTV and Uninett, Frikanalen is also
20 available as a Kodi addon. The last few days I have updated the code
21 to add more features. A
22 <a href=
"https://kodi.tv/addon/plugins-video-add-ons/frikanalen-nett-tv
">new
23 and improved version
0.0.3 Frikanalen addon
</a
> was just made
24 available via the Kodi repositories. This new version include a
25 option to browse videos by category, as well as free text search
26 in the video archive. It will now also show the video duration in the
27 video lists, which were missing earlier. A new and experimental
28 link to the HD video stream currently being worked on is provided, for
29 those that want to see what the
<a href=
"https://casparcg.com/
">CasparCG
</a
>
30 output look like. The alternative is the SD video stream, generated
31 using MLT. CasparCG is controlled by our
32 <a href=
"https://github.com/Frikanalen/mltplayout/
">mltplayout
33 server
</a
> which instead of talking to mlt is giving PLAY instructions
34 to the CasparCG server when it is time to start a new program.
</p
>
36 <p
>By now, you are probably wondering what kind of content is being
37 played on the video. These days, it is filled with technical
38 presentations like those from
<a href=
"https://www.nuug.no/
">NUUG
</a
>,
39 <a href=
"https://www.debconf.org/
">Debconf
</a
>, Makercon, and TED,
40 but there are also some periods with
41 <a href=
"https://www.empo.no/
">EMPT TV
</a
> and
42 <a href=
"https://www.p7.no/
">P7
</a
>.
44 <p
>As usual, if you use Bitcoin and want to show your support of my
45 activities, please send Bitcoin donations to my address
46 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
51 <title>Time for an official MIME type for patches?
</title>
52 <link>http://people.skolelinux.org/pere/blog/Time_for_an_official_MIME_type_for_patches_.html
</link>
53 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Time_for_an_official_MIME_type_for_patches_.html
</guid>
54 <pubDate>Thu,
1 Nov
2018 08:
15:
00 +
0100</pubDate>
55 <description><p
>As part of my involvement in
56 <a href=
"https://gitlab.com/OsloMet-ABI/nikita-noark5-core
">the Nikita
57 archive API project
</a
>, I
've been importing a fairly large lump of
58 emails into a test instance of the archive to see how well this would
59 go. I picked a subset of
<a href=
"https://notmuchmail.org/
">my
60 notmuch email database
</a
>, all public emails sent to me via
61 @lists.debian.org, giving me a set of around
216 000 emails to import.
62 In the process, I had a look at the various attachments included in
63 these emails, to figure out what to do with attachments, and noticed
64 that one of the most common attachment formats do not have
65 <a href=
"https://www.iana.org/assignments/media-types/media-types.xhtml
">an
66 official MIME type
</a
> registered with IANA/IETF. The output from
67 diff, ie the input for patch, is on the top
10 list of formats
68 included in these emails. At the moment people seem to use either
69 text/x-patch or text/x-diff, but neither is officially registered. It
70 would be better if one official MIME type were registered and used
73 <p
>To try to get one official MIME type for these files, I
've brought
75 <a href=
"https://www.ietf.org/mailman/listinfo/media-types
">the
76 media-types mailing list
</a
>. If you are interested in discussion
77 which MIME type to use as the official for patch files, or involved in
78 making software using a MIME type for patches, perhaps you would like
79 to join the discussion?
</p
>
81 <p
>As usual, if you use Bitcoin and want to show your support of my
82 activities, please send Bitcoin donations to my address
83 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
88 <title>Measuring the speaker frequency response using the AUDMES free software GUI - nice free software
</title>
89 <link>http://people.skolelinux.org/pere/blog/Measuring_the_speaker_frequency_response_using_the_AUDMES_free_software_GUI___nice_free_software.html
</link>
90 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Measuring_the_speaker_frequency_response_using_the_AUDMES_free_software_GUI___nice_free_software.html
</guid>
91 <pubDate>Mon,
22 Oct
2018 08:
40:
00 +
0200</pubDate>
92 <description><p
><img src=
"http://people.skolelinux.org/pere/blog/images/
2018-
10-
22-audmes-measure-speakers.png
" align=
"right
" width=
"40%
"/
></p
>
94 <p
>My current home stereo is a patchwork of various pieces I got on
95 flee markeds over the years. It is amazing what kind of equipment
96 show up there. I
've been wondering for a while if it was possible to
97 measure how well this equipment is working together, and decided to
98 see how far I could get using free software. After trawling the web I
99 came across an article from DIY Audio and Video on
100 <a href=
"https://www.diyaudioandvideo.com/Tutorial/SpeakerResponseTesting/
">Speaker
101 Testing and Analysis
</a
> describing how to test speakers, and it listing
102 several software options, among them
103 <a href=
"https://sourceforge.net/projects/audmes/
">AUDio MEasurement
104 System (AUDMES)
</a
>. It is the only free software system I could find
105 focusing on measuring speakers and audio frequency response. In the
106 process I also found an interesting article from NOVO on
107 <a href=
"http://novo.press/understanding-speaker-specifications-and-frequency-response/
">Understanding
108 Speaker Specifications and Frequency Response
</a
> and an article from
110 <a href=
"https://www.ecoustics.com/articles/understanding-speaker-frequency-response/
">Understanding
111 Speaker Frequency Response
</a
>, with a lot of information on what to
112 look for and how to interpret the graphs. Armed with this knowledge,
113 I set out to measure the state of my speakers.
</p
>
115 <p
>The first hurdle was that AUDMES hadn
't seen a commit for
10 years
116 and did not build with current compilers and libraries. I got in
117 touch with its author, who no longer was spending time on the program
118 but gave me write access to the subversion repository on Sourceforge.
119 The end result is that now the code build on Linux and is capable of
120 saving and loading the collected frequency response data in CSV
121 format. The application is quite nice and flexible, and I was able to
122 select the input and output audio interfaces independently. This made
123 it possible to use a USB mixer as the input source, while sending
124 output via my laptop headphone connection. I lacked the hardware and
125 cabling to figure out a different way to get independent cabling to
126 speakers and microphone.
</p
>
128 <p
>Using this setup I could see how a large range of high frequencies
129 apparently were not making it out of my speakers. The picture show
130 the frequency response measurement of one of the speakers. Note the
131 frequency lines seem to be slightly misaligned, compared to the CSV
132 output from the program. I can not hear several of these are high
133 frequencies, according to measurement from
134 <a href=
"http://freehearingtestsoftware.com
">Free Hearing Test
135 Software
</a
>, an freeware system to measure your hearing (still
136 looking for a free software alternative), so I do not know if they are
137 coming out out the speakers. I thus do not quite know how to figure
138 out if the missing frequencies is a problem with the microphone, the
139 amplifier or the speakers, but I managed to rule out the audio card in my
140 PC by measuring my Bose noise canceling headset using its own
141 microphone. This setup was able to see the high frequency tones, so
142 the problem with my stereo had to be in the amplifier or speakers.
</p
>
144 <p
>Anyway, to try to role out one factor I ended up picking up a new
145 set of speakers at a flee marked, and these work a lot better than the
146 old speakers, so I guess the microphone and amplifier is OK. If you
147 need to measure your own speakers, check out AUDMES. If more people
148 get involved, perhaps the project could become good enough to
149 <a href=
"https://bugs.debian.org/
910876">include in Debian
</a
>? And if
150 you know of some other free software to measure speakers and amplifier
151 performance, please let me know. I am aware of the freeware option
152 <a href=
"https://www.roomeqwizard.com/
">REW
</a
>, but I want something
153 that can be developed also when the vendor looses interest.
</p
>
155 <p
>As usual, if you use Bitcoin and want to show your support of my
156 activities, please send Bitcoin donations to my address
157 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
162 <title>Web browser integration of VLC with Bittorrent support
</title>
163 <link>http://people.skolelinux.org/pere/blog/Web_browser_integration_of_VLC_with_Bittorrent_support.html
</link>
164 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Web_browser_integration_of_VLC_with_Bittorrent_support.html
</guid>
165 <pubDate>Sun,
21 Oct
2018 09:
50:
00 +
0200</pubDate>
166 <description><p
>Bittorrent is as far as I know, currently the most efficient way to
167 distribute content on the Internet. It is used all by all sorts of
168 content providers, from national TV stations like
169 <a href=
"https://www.nrk.no/
">NRK
</a
>, Linux distributors like
170 <a href=
"https://www.debian.org/
">Debian
</a
> and
171 <a href=
"https://www.ubuntu.com/
">Ubuntu
</a
>, and of course the
172 <a href=
"https://archive.org/
">Internet archive
</A
>.
174 <p
>Almost a month ago
175 <a href=
"https://tracker.debian.org/pkg/vlc-plugin-bittorrent
">a new
176 package adding Bittorrent support to VLC
</a
> became available in
177 Debian testing and unstable. To test it, simply install it like
181 apt install vlc-plugin-bittorrent
182 </pre
></p
>
184 <p
>Since the plugin was made available for the first time in Debian,
185 several improvements have been made to it. In version
2.2-
4, now
186 available in both testing and unstable, a desktop file is provided to
187 teach browsers to start VLC when the user click on torrent files or
188 magnet links. The last part is thanks to me finally understanding
189 what the strange x-scheme-handler style MIME types in desktop files
190 are used for. By adding x-scheme-handler/magnet to the MimeType entry
191 in the desktop file, at least the browsers Firefox and Chromium will
192 suggest to start VLC when selecting a magnet URI on a web page. The
193 end result is that now, with the plugin installed in Buster and Sid,
195 <a href=
"https://archive.org/details/CopyingIsNotTheft1080p
">Internet
196 Archive page with movies
</a
> using a web browser and click on the
197 torrent link to start streaming the movie.
</p
>
199 <p
>Note, there is still some misfeatures in the plugin. One is the
200 fact that it will hang and
201 <a href=
"https://github.com/johang/vlc-bittorrent/issues/
13">block VLC
202 from exiting until the torrent streaming starts
</a
>. Another is the
204 <a href=
"https://github.com/johang/vlc-bittorrent/issues/
9">will pick
205 and play a random file in a multi file torrent
</a
>. This is not
206 always the video file you want. Combined with the first it can be a
207 bit hard to get the video streaming going. But when it work, it seem
208 to do a good job.
</p
>
210 <p
>For the Debian packaging, I would love to find a good way to test
211 if the plugin work with VLC using autopkgtest. I tried, but do not
212 know enough of the inner workings of VLC to get it working. For now
213 the autopkgtest script is only checking if the .so file was
214 successfully loaded by VLC. If you have any suggestions, please
215 submit a patch to the Debian bug tracking system.
</p
>
217 <p
>As usual, if you use Bitcoin and want to show your support of my
218 activities, please send Bitcoin donations to my address
219 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
224 <title>Release
0.2 of free software archive system Nikita announced
</title>
225 <link>http://people.skolelinux.org/pere/blog/Release_0_2_of_free_software_archive_system_Nikita_announced.html
</link>
226 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Release_0_2_of_free_software_archive_system_Nikita_announced.html
</guid>
227 <pubDate>Thu,
18 Oct
2018 14:
40:
00 +
0200</pubDate>
228 <description><p
>This morning, the new release of the
229 <a href=
"https://gitlab.com/OsloMet-ABI/nikita-noark5-core/
">Nikita
230 Noark
5 core project
</a
> was
231 <a href=
"https://lists.nuug.no/pipermail/nikita-noark/
2018-October/
000406.html
">announced
232 on the project mailing list
</a
>. The free software solution is an
233 implementation of the Norwegian archive standard Noark
5 used by
234 government offices in Norway. These were the changes in version
0.2
235 since version
0.1.1 (from NEWS.md):
238 <li
>Fix typos in REL names
</li
>
239 <li
>Tidy up error message reporting
</li
>
240 <li
>Fix issue where we used Integer.valueOf(), not Integer.getInteger()
</li
>
241 <li
>Change some String handling to StringBuffer
</li
>
242 <li
>Fix error reporting
</li
>
243 <li
>Code tidy-up
</li
>
244 <li
>Fix issue using static non-synchronized SimpleDateFormat to avoid
245 race conditions
</li
>
246 <li
>Fix problem where deserialisers were treating integers as strings
</li
>
247 <li
>Update methods to make them null-safe
</li
>
248 <li
>Fix many issues reported by coverity
</li
>
249 <li
>Improve equals(), compareTo() and hash() in domain model
</li
>
250 <li
>Improvements to the domain model for metadata classes
</li
>
251 <li
>Fix CORS issues when downloading document
</li
>
252 <li
>Implementation of case-handling with registryEntry and document upload
</li
>
253 <li
>Better support in Javascript for OPTIONS
</li
>
254 <li
>Adding concept description of mail integration
</li
>
255 <li
>Improve setting of default values for GET on ny-journalpost
</li
>
256 <li
>Better handling of required values during deserialisation
</li
>
257 <li
>Changed tilknyttetDato (M620) from date to dateTime
</li
>
258 <li
>Corrected some opprettetDato (M600) (de)serialisation errors.
</li
>
259 <li
>Improve parse error reporting.
</li
>
260 <li
>Started on OData search and filtering.
</li
>
261 <li
>Added Contributor Covenant Code of Conduct to project.
</li
>
262 <li
>Moved repository and project from Github to Gitlab.
</li
>
263 <li
>Restructured repository, moved code into src/ and web/.
</li
>
264 <li
>Updated code to use Spring Boot version
2.
</li
>
265 <li
>Added support for OAuth2 authentication.
</li
>
266 <li
>Fixed several bugs discovered by Coverity.
</li
>
267 <li
>Corrected handling of date/datetime fields.
</li
>
268 <li
>Improved error reporting when rejecting during deserializatoin.
</li
>
269 <li
>Adjusted default values provided for ny-arkivdel, ny-mappe,
270 ny-saksmappe, ny-journalpost and ny-dokumentbeskrivelse.
</li
>
271 <li
>Several fixes for korrespondansepart*.
</li
>
272 <li
>Updated web GUI:
274 <li
>Now handle both file upload and download.
</li
>
275 <li
>Uses new OAuth2 authentication for login.
</li
>
276 <li
>Forms now fetches default values from API using GET.
</li
>
277 <li
>Added RFC
822 (email), TIFF and JPEG to list of possible file formats.
</li
>
278 </ul
></li
>
281 <p
>The changes and improvements are extensive. Running diffstat on
282 the changes between git tab
0.1.1 and
0.2 show
1098 files changed,
283 108666 insertions(+),
54066 deletions(-).
</p
>
285 <p
>If free and open standardized archiving API sound interesting to
286 you, please contact us on IRC
287 (
<a href=
"irc://irc.freenode.net/%
23nikita
">#nikita on
288 irc.freenode.net
</a
>) or email
289 (
<a href=
"https://lists.nuug.no/mailman/listinfo/nikita-noark
">nikita-noark
290 mailing list
</a
>).
</p
>
292 <p
>As usual, if you use Bitcoin and want to show your support of my
293 activities, please send Bitcoin donations to my address
294 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
299 <title>Fetching trusted timestamps using the rfc3161ng python module
</title>
300 <link>http://people.skolelinux.org/pere/blog/Fetching_trusted_timestamps_using_the_rfc3161ng_python_module.html
</link>
301 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Fetching_trusted_timestamps_using_the_rfc3161ng_python_module.html
</guid>
302 <pubDate>Mon,
8 Oct
2018 12:
30:
00 +
0200</pubDate>
303 <description><p
>I have earlier covered the basics of trusted timestamping using the
304 'openssl ts
' client. See blog post for
305 <a href=
"http://people.skolelinux.org/pere/blog/Public_Trusted_Timestamping_services_for_everyone.html
">2014</a
>,
306 <a href=
"http://people.skolelinux.org/pere/blog/syslog_trusted_timestamp___chain_of_trusted_timestamps_for_your_syslog.html
">2016</a
>
308 <a href=
"http://people.skolelinux.org/pere/blog/Idea_for_storing_trusted_timestamps_in_a_Noark_5_archive.html
">2017</a
>
309 for those stories. But some times I want to integrate the timestamping
310 in other code, and recently I needed to integrate it into Python.
311 After searching a bit, I found
312 <a href=
"https://dev.entrouvert.org/projects/python-rfc3161
">the
313 rfc3161 library
</a
> which seemed like a good fit, but I soon
314 discovered it only worked for python version
2, and I needed something
315 that work with python version
3. Luckily I next came across
316 <a href=
"https://github.com/trbs/rfc3161ng/
">the rfc3161ng library
</a
>,
317 a fork of the original rfc3161 library. Not only is it working with
318 python
3, it have fixed a few of the bugs in the original library, and
319 it has an active maintainer. I decided to wrap it up and make it
320 <a href=
"https://tracker.debian.org/pkg/python-rfc3161ng
">available in
321 Debian
</a
>, and a few days ago it entered Debian unstable and testing.
</p
>
323 <p
>Using the library is fairly straight forward. The only slightly
324 problematic step is to fetch the required certificates to verify the
325 timestamp. For some services it is straight forward, while for others
326 I have not yet figured out how to do it. Here is a small standalone
327 code example based on of the integration tests in the library code:
</p
>
334 Python
3 script demonstrating how to use the rfc3161ng module to
335 get trusted timestamps.
337 The license of this code is the same as the license of the rfc3161ng
343 import pyasn1.codec.der
347 import urllib.request
354 def fetch(url, f=None):
355 response = urllib.request.urlopen(url)
356 data = response.read()
362 with tempfile.NamedTemporaryFile() as cert_f,\
363 tempfile.NamedTemporaryFile() as ca_f,\
364 tempfile.NamedTemporaryFile() as msg_f,\
365 tempfile.NamedTemporaryFile() as tsr_f:
367 # First fetch certificates used by service
368 certificate_data = fetch(
'https://freetsa.org/files/tsa.crt
', cert_f)
369 ca_data_data = fetch(
'https://freetsa.org/files/cacert.pem
', ca_f)
371 # Then timestamp the message
373 rfc3161ng.RemoteTimestamper(
'http://freetsa.org/tsr
',
374 certificate=certificate_data)
375 data = b
"Python forever!\n
"
376 tsr = timestamper(data=data, return_tsr=True)
378 # Finally, convert message and response to something
'openssl ts
' can verify
380 store(tsr_f, pyasn1.codec.der.encoder.encode(tsr))
381 args = [
"openssl
",
"ts
",
"-verify
",
382 "-data
", msg_f.name,
383 "-in
", tsr_f.name,
384 "-CAfile
", ca_f.name,
385 "-untrusted
", cert_f.name]
386 subprocess.check_call(args)
388 if
'__main__
' == __name__:
392 <p
>The code fetches the required certificates, store them as temporary
393 files, timestamp a simple message, store the message and timestamp to
394 disk and ask
'openssl ts
' to verify the timestamp. A timestamp is
395 around
1.5 kiB in size, and should be fairly easy to store for future
398 <p
>As usual, if you use Bitcoin and want to show your support of my
399 activities, please send Bitcoin donations to my address
400 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
405 <title>Automatic Google Drive sync using grive in Debian
</title>
406 <link>http://people.skolelinux.org/pere/blog/Automatic_Google_Drive_sync_using_grive_in_Debian.html
</link>
407 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Automatic_Google_Drive_sync_using_grive_in_Debian.html
</guid>
408 <pubDate>Thu,
4 Oct
2018 15:
20:
00 +
0200</pubDate>
409 <description><p
>A few days, I rescued a Windows victim over to Debian. To try to
410 rescue the remains, I helped set up automatic sync with Google Drive.
411 I did not find any sensible Debian package handling this
412 automatically, so I rebuild the grive2 source from
413 <a href=
"http://www.webupd8.org/
">the Ubuntu UPD8 PPA
</a
> to do the
414 task and added a autostart desktop entry and a small shell script to
415 run in the background while the user is logged in to do the sync.
416 Here is a sketch of the setup for future reference.
</p
>
418 <p
>I first created
<tt
>~/googledrive
</tt
>, entered the directory and
419 ran
'<tt
>grive -a
</tt
>' to authenticate the machine/user. Next, I
420 created a autostart hook in
<tt
>~/.config/autostart/grive.desktop
</tt
>
421 to start the sync when the user log in:
</p
>
423 <p
><blockquote
><pre
>
425 Name=Google drive autosync
427 Exec=/home/user/bin/grive-sync
428 </pre
></blockquote
></p
>
430 <p
>Finally, I wrote the
<tt
>~/bin/grive-sync
</tt
> script to sync
431 ~/googledrive/ with the files in Google Drive.
</p
>
433 <p
><blockquote
><pre
>
438 if [
"$syncpid
" ] ; then
442 trap cleanup EXIT INT QUIT
443 /usr/lib/grive/grive-sync.sh listen googledrive
2>&1 | sed
"s%^%$
0:%
" &
446 if ! xhost
>/dev/null
2>&1 ; then
447 echo
"no DISPLAY, exiting as the user probably logged out
"
450 if [ ! -e /run/user/
1000/grive-sync.sh_googledrive ] ; then
451 /usr/lib/grive/grive-sync.sh sync googledrive
454 done
2>&1 | sed
"s%^%$
0:%
"
455 </pre
></blockquote
></p
>
457 <p
>Feel free to use the setup if you want. It can be assumed to be
458 GNU GPL v2 licensed (or any later version, at your leisure), but I
459 doubt this code is possible to claim copyright on.
</p
>
461 <p
>As usual, if you use Bitcoin and want to show your support of my
462 activities, please send Bitcoin donations to my address
463 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
468 <title>Valutakrambod - A python and bitcoin love story
</title>
469 <link>http://people.skolelinux.org/pere/blog/Valutakrambod___A_python_and_bitcoin_love_story.html
</link>
470 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Valutakrambod___A_python_and_bitcoin_love_story.html
</guid>
471 <pubDate>Sat,
29 Sep
2018 22:
20:
00 +
0200</pubDate>
472 <description><p
>It would come as no surprise to anyone that I am interested in
473 bitcoins and virtual currencies. I
've been keeping an eye on virtual
474 currencies for many years, and it is part of the reason a few months
475 ago, I started writing a python library for collecting currency
476 exchange rates and trade on virtual currency exchanges. I decided to
477 name the end result valutakrambod, which perhaps can be translated to
478 small currency shop.
</p
>
480 <p
>The library uses the tornado python library to handle HTTP and
481 websocket connections, and provide a asynchronous system for
482 connecting to and tracking several services. The code is available
484 <a href=
"http://github.com/petterreinholdtsen/valutakrambod
">github
</a
>.
</p
>
486 </p
>There are two example clients of the library. One is very simple and
487 list every updated buy/sell price received from the various services.
488 This code is started by running bin/btc-rates and call the client code
489 in valutakrambod/client.py. The simple client look like this:
</p
>
491 <p
><blockquote
><pre
>
493 import tornado.ioloop
495 class SimpleClient(object):
500 def newdata(self, service, pair, changed):
501 print(
"%-
15s %s-%s: %
8.3f %
8.3f
" % (
502 service.servicename(),
505 service.rates[pair][
'ask
'],
506 service.rates[pair][
'bid
'])
508 async def refresh(self, service):
509 await service.fetchRates(service.wantedpairs)
511 self.ioloop = tornado.ioloop.IOLoop.current()
512 self.services = valutakrambod.service.knownServices()
513 for e in self.services:
515 service.subscribe(self.newdata)
516 stream = service.websocket()
518 self.streams.append(stream)
520 # Fetch information from non-streaming services immediately
521 self.ioloop.call_later(len(self.services),
522 functools.partial(self.refresh, service))
523 # as well as regularly
524 service.periodicUpdate(
60)
525 for stream in self.streams:
529 except KeyboardInterrupt:
530 print(
"Interrupted by keyboard, closing all connections.
")
532 for stream in self.streams:
534 </pre
></blockquote
></p
>
536 <p
>The library client loops over all known
"public
" services,
537 initialises it, subscribes to any updates from the service, checks and
538 activates websocket streaming if the service provide it, and if no
539 streaming is supported, fetches information from the service and sets
540 up a periodic update every
60 seconds. The output from this client
541 can look like this:
</p
>
543 <p
><blockquote
><pre
>
544 Bl3p BTC-EUR:
5687.110 5653.690
545 Bl3p BTC-EUR:
5687.110 5653.690
546 Bl3p BTC-EUR:
5687.110 5653.690
547 Hitbtc BTC-USD:
6594.560 6593.690
548 Hitbtc BTC-USD:
6594.560 6593.690
549 Bl3p BTC-EUR:
5687.110 5653.690
550 Hitbtc BTC-USD:
6594.570 6593.690
551 Bitstamp EUR-USD:
1.159 1.154
552 Hitbtc BTC-USD:
6594.570 6593.690
553 Hitbtc BTC-USD:
6594.580 6593.690
554 Hitbtc BTC-USD:
6594.580 6593.690
555 Hitbtc BTC-USD:
6594.580 6593.690
556 Bl3p BTC-EUR:
5687.110 5653.690
557 Paymium BTC-EUR:
5680.000 5620.240
558 </pre
></blockquote
></p
>
560 <p
>The exchange order book is tracked in addition to the best buy/sell
561 price, for those that need to know the details.
</p
>
563 <p
>The other example client is focusing on providing a curses view
564 with updated buy/sell prices as soon as they are received from the
565 services. This code is located in bin/btc-rates-curses and activated
566 by using the
'-c
' argument. Without the argument the
"curses
" output
567 is printed without using curses, which is useful for debugging. The
568 curses view look like this:
</p
>
570 <p
><blockquote
><pre
>
571 Name Pair Bid Ask Spr Ftcd Age
572 BitcoinsNorway BTCEUR
5591.8400 5711.0800 2.1%
16 nan
60
573 Bitfinex BTCEUR
5671.0000 5671.2000 0.0%
16 22 59
574 Bitmynt BTCEUR
5580.8000 5807.5200 3.9%
16 41 60
575 Bitpay BTCEUR
5663.2700 nan nan%
15 nan
60
576 Bitstamp BTCEUR
5664.8400 5676.5300 0.2%
0 1 1
577 Bl3p BTCEUR
5653.6900 5684.9400 0.5%
0 nan
19
578 Coinbase BTCEUR
5600.8200 5714.9000 2.0%
15 nan nan
579 Kraken BTCEUR
5670.1000 5670.2000 0.0%
14 17 60
580 Paymium BTCEUR
5620.0600 5680.0000 1.1%
1 7515 nan
581 BitcoinsNorway BTCNOK
52898.9700 54034.6100 2.1%
16 nan
60
582 Bitmynt BTCNOK
52960.3200 54031.1900 2.0%
16 41 60
583 Bitpay BTCNOK
53477.7833 nan nan%
16 nan
60
584 Coinbase BTCNOK
52990.3500 54063.0600 2.0%
15 nan nan
585 MiraiEx BTCNOK
52856.5300 54100.6000 2.3%
16 nan nan
586 BitcoinsNorway BTCUSD
6495.5300 6631.5400 2.1%
16 nan
60
587 Bitfinex BTCUSD
6590.6000 6590.7000 0.0%
16 23 57
588 Bitpay BTCUSD
6564.1300 nan nan%
15 nan
60
589 Bitstamp BTCUSD
6561.1400 6565.6200 0.1%
0 2 1
590 Coinbase BTCUSD
6504.0600 6635.9700 2.0%
14 nan
117
591 Gemini BTCUSD
6567.1300 6573.0700 0.1%
16 89 nan
592 Hitbtc+BTCUSD
6592.6200 6594.2100 0.0%
0 0 0
593 Kraken BTCUSD
6565.2000 6570.9000 0.1%
15 17 58
594 Exchangerates EURNOK
9.4665 9.4665 0.0%
16 107789 nan
595 Norgesbank EURNOK
9.4665 9.4665 0.0%
16 107789 nan
596 Bitstamp EURUSD
1.1537 1.1593 0.5%
4 5 1
597 Exchangerates EURUSD
1.1576 1.1576 0.0%
16 107789 nan
598 BitcoinsNorway LTCEUR
1.0000 49.0000 98.0%
16 nan nan
599 BitcoinsNorway LTCNOK
492.4800 503.7500 2.2%
16 nan
60
600 BitcoinsNorway LTCUSD
1.0221 49.0000 97.9%
15 nan nan
601 Norgesbank USDNOK
8.1777 8.1777 0.0%
16 107789 nan
602 </pre
></blockquote
></p
>
604 <p
>The code for this client is too complex for a simple blog post, so
605 you will have to check out the git repository to figure out how it
606 work. What I can tell is how the three last numbers on each line
607 should be interpreted. The first is how many seconds ago information
608 was received from the service. The second is how long ago, according
609 to the service, the provided information was updated. The last is an
610 estimate on how often the buy/sell values change.
</p
>
612 <p
>If you find this library useful, or would like to improve it, I
613 would love to hear from you. Note that for some of the services I
've
614 implemented a trading API. It might be the topic of a future blog
617 <p
>As usual, if you use Bitcoin and want to show your support of my
618 activities, please send Bitcoin donations to my address
619 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
624 <title>VLC in Debian now can do bittorrent streaming
</title>
625 <link>http://people.skolelinux.org/pere/blog/VLC_in_Debian_now_can_do_bittorrent_streaming.html
</link>
626 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/VLC_in_Debian_now_can_do_bittorrent_streaming.html
</guid>
627 <pubDate>Mon,
24 Sep
2018 21:
20:
00 +
0200</pubDate>
628 <description><p
>Back in February, I got curious to see
629 <a href=
"http://people.skolelinux.org/pere/blog/Using_VLC_to_stream_bittorrent_sources.html
">if
630 VLC now supported Bittorrent streaming
</a
>. It did not, despite the
631 fact that the idea and code to handle such streaming had been floating
632 around for years. I did however find
633 <a href=
"https://github.com/johang/vlc-bittorrent
">a standalone plugin
634 for VLC
</a
> to do it, and half a year later I decided to wrap up the
635 plugin and get it into Debian. I uploaded it to NEW a few days ago,
636 and am very happy to report that it
637 <a href=
"https://tracker.debian.org/pkg/vlc-plugin-bittorrent
">entered
638 Debian
</a
> a few hours ago, and should be available in Debian/Unstable
639 tomorrow, and Debian/Testing in a few days.
</p
>
641 <p
>With the vlc-plugin-bittorrent package installed you should be able
642 to stream videos using a simple call to
</p
>
644 <p
><blockquote
><pre
>
645 vlc https://archive.org/download/TheGoat/TheGoat_archive.torrent
646 </pre
></blockquote
></p
>
648 </p
>It can handle magnet links too. Now if only native vlc had
649 bittorrent support. Then a lot more would be helping each other to
650 share public domain and creative commons movies. The plugin need some
651 stability work with seeking and picking the right file in a torrent
652 with many files, but is already usable. Please note that the plugin
653 is not removing downloaded files when vlc is stopped, so it can fill
654 up your disk if you are not careful. Have fun. :)
</p
>
656 <p
>I would love to get help maintaining this package. Get in touch if
657 you are interested.
</p
>
659 <p
>As usual, if you use Bitcoin and want to show your support of my
660 activities, please send Bitcoin donations to my address
661 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>
666 <title>Using the Kodi API to play Youtube videos
</title>
667 <link>http://people.skolelinux.org/pere/blog/Using_the_Kodi_API_to_play_Youtube_videos.html
</link>
668 <guid isPermaLink=
"true">http://people.skolelinux.org/pere/blog/Using_the_Kodi_API_to_play_Youtube_videos.html
</guid>
669 <pubDate>Sun,
2 Sep
2018 23:
40:
00 +
0200</pubDate>
670 <description><p
>I continue to explore my Kodi installation, and today I wanted to
671 tell it to play a youtube URL I received in a chat, without having to
672 insert search terms using the on-screen keyboard. After searching the
673 web for API access to the Youtube plugin and testing a bit, I managed
674 to find a recipe that worked. If you got a kodi instance with its API
675 available from http://kodihost/jsonrpc, you can try the following to
676 have check out a nice cover band.
</p
>
678 <p
><blockquote
><pre
>curl --silent --header
'Content-Type: application/json
' \
679 --data-binary
'{
"id
":
1,
"jsonrpc
":
"2.0",
"method
":
"Player.Open
",
680 "params
": {
"item
": {
"file
":
681 "plugin://plugin.video.youtube/play/?video_id=LuRGVM9O0qg
" } } }
' \
682 http://projector.local/jsonrpc
</pre
></blockquote
></p
>
684 <p
>I
've extended kodi-stream program to take a video source as its
685 first argument. It can now handle direct video links, youtube links
686 and
'desktop
' to stream my desktop to Kodi. It is almost like a
687 Chromecast. :)
</p
>
689 <p
>As usual, if you use Bitcoin and want to show your support of my
690 activities, please send Bitcoin donations to my address
691 <b
><a href=
"bitcoin:
15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
">15oWEoG9dUPovwmUL9KWAnYRtNJEkP1u1b
</a
></b
>.
</p
>