updated field separator
[mpvhistory] / MetaDataHistory.lua
1 -- Music Log for MPV player
2 --Rev. Fr. Robert Bower
3 --
4 --
5 --Bits and bobs taken from 
6 --********
7 -- -- Copyright (c) 2021, Eisa AlAwadhi
8 -- License: BSD 2-Clause License
9
10 -- Creator: Eisa AlAwadhi
11 -- Project: SmartHistory
12 -- Version: 1.7.1
13 -- *************
14
15
16 mp.register_event('file-loaded', function()
17         filePath = mp.get_property('path')
18         metadata = mp.get_property('filtered-metadata')
19         end)
20         
21 mp.register_event('file-loaded', function()
22         empty = false
23         local historyLog = (os.getenv('APPDATA') or os.getenv('HOME')..'/.config')..'/mpv/mpvHistory.log'
24         local historyLogAdd = io.open(historyLog, 'a+')
25         
26         
27         if (filePath ~= nil) then
28                 historyLogAdd:write(('[%s] %s\n'):format(os.date('%d/%b/%y %X'), metadata ))
29                 historyLogAdd:close()
30         end
31 end)
32
33