Hi,
Unknown to us, for a group of one of our regular 1/2 hour shows, the
supplied files already had metadata titles.
We run a function to act as fill-in for missing titles for all shows using
the filename of the episode.
Unfortunately, since the metadata title has been supplied, the function
dos not work as expected.
I would like to modify this function to always override the title with a
filename supplied (whether a title
has been provided previously or not).
The code in question:
# === CIL ORIGINAL ===
1 a = playlist.safe(mode="normal",
"/usr/local/www/rcr/radio/current/mp3/cil-mp3-top.pls")
2 b = playlist.safe(mode="normal",
"/usr/local/www/rcr/radio/current/mp3/today-cil-mp3.pls")
3 c = playlist.safe(mode="normal",
"/usr/local/www/rcr/radio/current/mp3/cil-mp3-end.pls")
4 cil = sequence([a,b,c])
5 # Fill-in Title for ID3 Tag
6 def fill_in(s)
# the function f takes a list of pairs m representing
the metadata
# and it maps an anonymous function on each pair
# replacing empty title definitions by title=filename
7 def f(m)
8 print("\n\nFor metadata: #{m}\n\n")
9 list.map(fun (key_value) ->
10 if key_value==("title","") then
11 if m["filename"] ==
"/usr/local/www/rcr/mp3/announce/TOHS.mp3" then
12 ("title", "Rural Catholic Radio - from
the heartland, with
love")
13 elsif m["filename"] ==
"/usr/local/www/rcr/mp3/announce/opener/opener-cil.mp3" then
14 ("title", "Welcome to Christianity in
Literature")
15 elsif m["filename"] ==
"/usr/local/www/rcr/radio/current/mp3/today-cil-mp3.pls" then
16 ("title", "Christianity in Literature -
with Joseph Finnell
and Richard Hyatt - see www.RuralCatholicRadio.com for details")
17 elsif m["filename"] ==
"/usr/local/www/rcr/mp3/announce/CLOSER.mp3" then
18 ("title", "Thank you for listening to
Christianity in
Literature - with Joseph Finnell and Richard Hyatt")
19 elsif m["filename"] ==
"/usr/local/www/rcr/radio/current/mp3/cil-mp3-end.pls" then
20 ("title", "Christianity in Literature -
with Joseph Finnell
and Richard Hyatt - see www.RuralCatholicRadio.com for details")
21 else ("title", "Christianity in Literature -
with Joseph Finnell
and Richard Hyatt - see www.RuralCatholicRadio.com for details")
22 end
23 else key_value end,
24 m)
25 end
26 map_metadata(f,s)
27 end
28 cil = fill_in(cil)
******
I was wondering whether by dropping lines 10, 23-25 (the 'if
key_value==("title", "")' it would work. I have no way of testing this
locally.
Or, even better, it would be great if I could simply use:
'if key_value!=("title", "")' [instead of '==' use '!=' but I'm not sure
whether it would work].
By dropping those lines, the code would then be:
# === CIL NEW ===
a = playlist.safe(mode="normal",
"/usr/local/www/rcr/radio/current/mp3/cil-mp3-top.pls")
b = playlist.safe(mode="normal",
"/usr/local/www/rcr/radio/current/mp3/today-cil-mp3.pls")
c = playlist.safe(mode="normal",
"/usr/local/www/rcr/radio/current/mp3/cil-mp3-end.pls")
cil = sequence([a,b,c])
# Fill-in Title for ID3 Tag
def fill_in(s)
# the function f takes a list of pairs m representing
the metadata
# and it maps an anonymous function on each pair
# replacing empty title definitions by title=filename
def f(m)
print("\n\nFor metadata: #{m}\n\n")
if m["filename"] ==
"/usr/local/www/rcr/mp3/announce/TOHS.mp3" then
("title", "Rural Catholic Radio - from
the heartland, with love")
elsif m["filename"] ==
"/usr/local/www/rcr/mp3/announce/opener/opener-cil.mp3" then
("title", "Welcome to Christianity in
Literature")
elsif m["filename"] ==
"/usr/local/www/rcr/radio/current/mp3/today-cil-mp3.pls" then
("title", "Christianity in Literature -
with Joseph Finnell and
Richard Hyatt - see www.RuralCatholicRadio.com for details")
elsif m["filename"] ==
"/usr/local/www/rcr/mp3/announce/CLOSER.mp3"
then
("title", "Thank you for listening to
Christianity in Literature
- with Joseph Finnell and Richard Hyatt")
elsif m["filename"] ==
"/usr/local/www/rcr/radio/current/mp3/cil-mp3-end.pls" then
("title", "Christianity in Literature -
with Joseph Finnell and
Richard Hyatt - see www.RuralCatholicRadio.com for details")
else ("title", "Christianity in Literature -
with Joseph Finnell and
Richard Hyatt - see www.RuralCatholicRadio.com for details")
end
map_metadata(f,s)
end
cil = fill_in(cil)
Your help appreciated!
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users