HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: Vittorio on 2021-10-09 08:53:45

Title: Write playback history to file
Post by: Vittorio on 2021-10-09 08:53:45
I'm lookin for a plugin that can write the playback history to a file.

A couple of years ago I had it already working, but after my HDD crashed I had to customize foobar from scratch.
Unfortunately I can't remember which plugin I have used and if it's still working with the latest foobar.

Here are three components I found, but they don't seem to do what I want:
foo_playcount (https://www.foobar2000.org/components/view/foo_playcount)
foo_playback_custom (http://kitahei.cocolog-nifty.com/youyou/2009/04/foo_playback_-1.html)
foo_playlisthistory (https://www.foobar2000.org/components/view/foo_playlisthistory)

Does something I need even exist?
Title: Re: Write playback history to file
Post by: marc2k3 on 2021-10-09 09:03:40
https://skipyrich.com/wiki/Foobar2000:Now_Playing_Simple
Title: Re: Write playback history to file
Post by: Vittorio on 2021-10-09 09:47:30
https://skipyrich.com/wiki/Foobar2000:Now_Playing_Simple

Many thanks, this is exactly what I was looking for.

One more question: Is there a way to format the %datetime% String to be YYYY-MM-DD HH:MM:SS?

Right now it looks lie this: "Sat Oct 09 10:45:46 2021"
Title: Re: Write playback history to file
Post by: regor on 2021-10-09 10:41:49
https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#Time_and_date_functions
Quote
$date(time)
Retrieves the date part (formatted as YYYY-MM-DD) from a time/date string.
$time(time)
Retrieves the time part (formatted as HH:MM:SS or HH:MM) from a date/time string
Join both :)
Code: [Select]
$date(%datetime%) $time(%datetime%)
Title: Re: Write playback history to file
Post by: Vittorio on 2021-10-09 12:59:24
Unfortunately that's not working, I just get a "?"

See Screenshot on OneDrive (https://1drv.ms/u/s!AqriqoLzwEu5qW2rkpVVE0Lh_Y4y)

Any other ideas?
Well, I could write a script that takes the datetime string and converts it to what I need, but maybe there's a simpler solution.
Title: Re: Write playback history to file
Post by: regor on 2021-10-09 13:55:42
Was expecting %datetime% followed TF format like the dates retrieved by other plugins (*).  obviously without that format it doesn't work. Use substring and extract what you need manually, there is no other way. You will need multiple calls to extract every part.
https://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#.24substr.28str.2Cfrom.2Cto.29

X

 (*) YYYY-MM-DD hh:mm:ss

EDIT:
You need to create a a substitution for all 12 months. Like the first line. Have no idea what format the plugin uses, if it's always 3 chars, etc. so adjust as needed.
Code: [Select]
$if($stricmp($substr(%datetime%,5,7),Oct),$puts(month,10),)
$right(%datetime%,4)-$get(month)-$left($right(%datetime%,16),2) $left($right(%datetime%,13),8)

X
Title: Re: Write playback history to file
Post by: Vittorio on 2021-10-09 14:17:14
I've got it:
Code: [Select]
$puts(txt,%datetime%)
$puts(weekday,$left($get(txt),3))
$puts(month,$right($left($get(txt),7),3))
$puts(day,$right($left($get(txt),10),2))
$puts(time,$left($right($get(txt),13),8))
$puts(year,$right($get(txt),4))

$get(day).
$ifequal($stricmp($get(month),jan),1,01,)
$ifequal($stricmp($get(month),feb),1,02,)
$ifequal($stricmp($get(month),mar),1,03,)
$ifequal($stricmp($get(month),apr),1,04,)
$ifequal($stricmp($get(month),may),1,05,)
$ifequal($stricmp($get(month),jun),1,06,)
$ifequal($stricmp($get(month),jul),1,07,)
$ifequal($stricmp($get(month),aug),1,08,)
$ifequal($stricmp($get(month),sep),1,09,)
$ifequal($stricmp($get(month),oct),1,10,)
$ifequal($stricmp($get(month),nov),1,11,)
$ifequal($stricmp($get(month),dec),1,12,)
.$get(year)
 $get(time)
$tab()
%artist% - %title%$crlf()

Finally ,this is exactly what I need:
(https://ams02pap001files.storage.live.com/y4pN3Bt8Mq1cIp3FtrlbvnVGczh0t227vlLl0QVPyGTe6fXfuE4svZ0Ku_rsUScPADuhntz92lMFoW9dmuPz2eG5yUQlbD7jlPOn6WPDwvGFFf36x0i-0j537v7JvQML9-BSx608dfeSBt-Auozcrd2A0x2L7lWjlgrkr1Y4_DZCTImb1iCFWPpQC-jXEtbqurr/2021-10-09%2015_14_37-Preferences_%20Now%20Playing%20Simple.png?psid=1&width=480&height=444)


P.S.: Working with variables makes life much easier 😉