Description: VLC Song Tracker is a extension that will help keep track of which songs were played in VLC.
The information of each song will be saved to a CSV ("Comma Separated Values") file with the following data. The date and time in which the song was played as well as the song information including Title, Artist, Album, Genre, Comments, and the location in which it was played at. The location can be a url for internet radio or the file where it was played from. The CSV will will be able to be parsed by most applications. One example of parsing is a spreadsheet application (LibreOffice Calc).
Installation Instructions: Place this file in the corresponding folder(Create the folder if it does not exist) and restart VLC or reload plugin extensions. To enable VLC Song Tracker click on View -> "VLC Song Tracker" under the menu bar.
Linux: Current User: ~/.local/share/vlc/lua/extensions/ All Users: /usr/lib/vlc/lua/extensions/
Windows: Current User: %APPDATA%vlcluaextensions All Users: %ProgramFiles%VideoLANVLCluaextensions
Mac OS X: Current User: /Users/%your_name%/Library/Application Support/org.videolan.vlc/lua/extensions/ All Users: /Applications/VLC.app/Contents/MacOS/share/lua/extensions/
Song List Location The SongList.csv will be saved in the vlc user director which can be found in the following places Linux: ~/.local/share/vlc/SongList.csv Windows: %APPDATA%vlcSongList.csv Mac OS X: /Users/%your_name%/Library/Application Support/org.videolan.vlc/SongList.csvLast changelog:
0.1.5
Added Now Playing Meta tag (suggested by dvxyz). Recommend creating new Songfile(move/rename) to keep new naming convention consistent.
It is not CSV file unless commas are quoted when found in a field, and that is not rare in song-titles. Therefore, too lazy to find out how to write a Lua quoting function, in my copy I changed the separator to HT (tab), since in ID3 it is forbidden. I also changed the timestamp to one field.
Now I know why, Internet radio, the whole string is compared for change of piece, but for me change in URI is the right thing.
But I am glad you wrote it, I had no idea how all this worked, but from the working I suspect it is hard to make this work well from an extension.
This doesn't work properly with the Media Library, which I use constantly.
I have to manually play a song in the ML for it to be recorded in the CSV file.
This does not happen if I make a Playlist. However, the ML is just a playlist in VLCs eyes, since it's a xspf file, so it should work.
Also, I have to activate it every time I open VLC. That's terrifically inconvenient - it trivializes the extension because 90% of the time I'll forget to activate it because it's a passive feature, not an active one.
Thank you for writing this. This is the first vlc extension I have looked at and I am not a lua coder - I did notice that whatever is triggering the writing out of a csv row can happen many times for the same media item playing - fast forwarding etc.. all trigger a write. I made a slight change to the code to suit my needs that I added a couple of global variables LocationNow "" and LocationLast "" so I can write out 1 row per media item. My code is probably pretty bad but now I get 1 row per item played. I certainly could not have gotten this to work without all of the work you did on this. Thanks again. It is perfect for my needs.
-- uri information
local uri = item:uri()
LocationNow = uri
local info = date .. CSV_FS .. time .. CSV_FS .. title .. CSV_FS .. artist .. CSV_FS .. album .. CSV_FS .. genre .. CSV_FS .. description .. CSV_FS .. uri
if LocationLast ~= LocationNow then
write_file(info)
LocationLast = LocationNow
end
Thank you for the comment. I am thrilled that my code was able to help you out. Also that is a great idea for your changes to eliminate duplicate songs from playing. One thing I would recommend is using the value from "title" instead of "uri". The reason is that "uri" usually does not change on a radio station so if you want to only write new songs you should compare the title of the songs if they are unique unless use a combination of title, artist, album, etc. Hope that will help.
Ratings & Comments
6 Comments
It is not CSV file unless commas are quoted when found in a field, and that is not rare in song-titles. Therefore, too lazy to find out how to write a Lua quoting function, in my copy I changed the separator to HT (tab), since in ID3 it is forbidden. I also changed the timestamp to one field. Now I know why, Internet radio, the whole string is compared for change of piece, but for me change in URI is the right thing. But I am glad you wrote it, I had no idea how all this worked, but from the working I suspect it is hard to make this work well from an extension.
This doesn't work properly with the Media Library, which I use constantly. I have to manually play a song in the ML for it to be recorded in the CSV file. This does not happen if I make a Playlist. However, the ML is just a playlist in VLCs eyes, since it's a xspf file, so it should work.
Also, I have to activate it every time I open VLC. That's terrifically inconvenient - it trivializes the extension because 90% of the time I'll forget to activate it because it's a passive feature, not an active one.
9 +
Thank you for writing this. This is the first vlc extension I have looked at and I am not a lua coder - I did notice that whatever is triggering the writing out of a csv row can happen many times for the same media item playing - fast forwarding etc.. all trigger a write. I made a slight change to the code to suit my needs that I added a couple of global variables LocationNow "" and LocationLast "" so I can write out 1 row per media item. My code is probably pretty bad but now I get 1 row per item played. I certainly could not have gotten this to work without all of the work you did on this. Thanks again. It is perfect for my needs. -- uri information local uri = item:uri() LocationNow = uri local info = date .. CSV_FS .. time .. CSV_FS .. title .. CSV_FS .. artist .. CSV_FS .. album .. CSV_FS .. genre .. CSV_FS .. description .. CSV_FS .. uri if LocationLast ~= LocationNow then write_file(info) LocationLast = LocationNow end
Thank you for the comment. I am thrilled that my code was able to help you out. Also that is a great idea for your changes to eliminate duplicate songs from playing. One thing I would recommend is using the value from "title" instead of "uri". The reason is that "uri" usually does not change on a radio station so if you want to only write new songs you should compare the title of the songs if they are unique unless use a combination of title, artist, album, etc. Hope that will help.