lastfm_scrobbler fix formatting, progress messages, export mode

make the plugin context aware to allow user to one
click export from a shortcut, basically it checks if its running in the
file browser if elsewhere does auto export

use a buffer for the fixed portion of the scrobble data

add timed_yield to long running operations
add progress bars and messages as scanning for duplicates takes a while
speed up duplicate scanning 4x

1000 tracks processing took ~2 minutes with duplicate scanning down from ~5

previous patch makes playback logging create a new file after 512k
old files renamed playback_0001.log
make scrobbler able to parse these log files

add ability to skip tracks without metadata and count them

Remove duplicates only for resume or remove all duplicates

allow skipping tracks without metadata or save only filename

update manual

Change-Id: I115bcfd3381f5a978252aac1cdfcc080f0797dda
This commit is contained in:
William Wilgus 2025-02-13 11:33:13 -05:00 committed by William Wilgus
parent 731f3fd8be
commit dad8f163c3
3 changed files with 687 additions and 359 deletions

File diff suppressed because it is too large Load diff

View file

@ -326,7 +326,7 @@ you to configure settings related to audio playback.
\setting{Prefer Embedded} album art. \setting{Prefer Embedded} album art.
} }
\section{Logging}\index{Logging} \section{Logging}\index{Logging}\label{sec:playbacklogging}
This option will record information about tracks played on the device This option will record information about tracks played on the device
in the following format 'timestamp:elapsed(ms):length(ms):path' in the following format 'timestamp:elapsed(ms):length(ms):path'
Devices without a Real Time Clock will use current system tick. Devices without a Real Time Clock will use current system tick.
@ -337,7 +337,7 @@ you to configure settings related to audio playback.
devices with Real Time Clock will record the date and time as well. devices with Real Time Clock will record the date and time as well.
When the log gets too large (\textasciitilde 1500 tracks) it will be split into playback\_nnnn.log When the log gets too large (\textasciitilde 1500 tracks) it will be split into playback\_nnnn.log
where nnnn is 0001-9999} where nnnn is 0001-9999}
see \setting{LastFm Scrobbler} plugin. see \setting{LastFm Scrobbler} plugin [\ref{sec:scrobbler}].
\begin{verbatim} \begin{verbatim}
the log can be found under '/.rockbox/playback.log' the log can be found under '/.rockbox/playback.log'
\end{verbatim} \end{verbatim}

View file

@ -1,33 +1,55 @@
\subsection{LastFm Scrobbler} \subsection{LastFm Scrobbler}\label{sec:scrobbler}
The \setting{LastFm Scrobbler} plugin enables you to parse the rockbox The \setting{LastFm Scrobbler} plugin enables you to parse the rockbox
playback log for tracks you have played for your own logging or upload playback log for tracks you have played for your own logging or upload
to scrobbling services, such as Last.fm, Libre.fm or ListenBrainz. to scrobbling services, such as Last.fm, Libre.fm or ListenBrainz.
\setting{Playback Logging} must be enabled to record the tracks played \setting{Playback Logging} [\ref{sec:playbacklogging}] must be enabled to record the tracks played.
the plugin will ask you to enable logging if run with logging disabled. The plugin will ask you to enable logging if run with logging disabled.
\subsubsection{Menu} \subsubsection{Menu}
\begin{itemize} \begin{itemize}
\item Remove duplicates - Only keeps the same track with the most time elapsed. \item Remove duplicates - Only keeps the same track with the most time elapsed.
\begin{description}
\item[Off.] Disables duplicate scanning, all tracks saved.
%
\item[Resume Playback.] No duplicates across track resumes, back to back plays
were probably just a track resume, only the longest elapsed play will be saved.
%
\item[All.] No duplicates, only the longest elapsed play will be saved regardless of when it was played.
\end{description}
\item Delete playback log - Remove the current playback log once it has been read. \item Delete playback log - Remove the current playback log once it has been read.
\item Save threshold - Percentage of track played to be considered 'L'istened. \item Threshold - Percentage of track played to be considered 'L'istened.
\item Minimum elapsed (ms) - Tracks played less than this will not be recorded in log. \item Minimum elapsed (ms) - Tracks played less than this will not be recorded in log.
\item Track Info - Only keeps tracks with metadata.
\begin{description}
\item[All.] Tracks saved regardless of metadata availibility.
%
\item[Skip if Missing.] Tracks without metadata will not be saved.
%
\item[Track Name Only.] Tracks not scanned for metadata, only filename saved.
\end{description}
\item View log - View the current playback log. \item View log - View the current playback log.
\item Revert to Default - Default settings restored. \item Revert to Default - Default settings restored.
\item Cancel - Exit, you will be asked to save any changes \item Cancel - Exit, you will be asked to save any changes
\item Export - Append scrobbler log and save any changes, not visible if no playback log exists. \item Export - Append scrobbler log and save any changes, not visible if no playback log exists.
\end{itemize} \end{itemize}
After the plugin has exported the scrobbler log you can find it in the root \note{\begin{itemize}
\item After the plugin has exported the scrobbler log you can find it in the root
of the drive '.scrobbler.log' open it in the file browser to view the log. of the drive '.scrobbler.log' open it in the file browser to view the log.
%
\item Subsequent exports will be appended to .scrobbler.log thus Delete playback log is advised.
%
\item Once setup you may run the scrobbler plugin from a shortcut and it will
auto export the playback log and exit.
If you would like to change settings run \setting{LastFm Scrobbler} from
the \setting{Plugins Menu}.
%
\item A copy of the playback log can be found in '/rockbox/playback\_old.log' it will be overwritten with each export.
Subsequent exports will be appended to .scrobbler.log thus Delete playback log is advised. \end{itemize}
}
\begin{verbatim}
A copy of the log can be found in
'/rockbox/playback.old'
it will be overwritten with each export
\end{verbatim}
\subsubsection{Format} \subsubsection{Format}
Data will be saved in Audioscrobbler spec at: (use wayback machine). Data will be saved in Audioscrobbler spec at: (use wayback machine).
@ -49,5 +71,5 @@ tab '\t' separated followed by newline '\n'
\item MUSICBRAINZ-TRACKID \item MUSICBRAINZ-TRACKID
\end{itemize} \end{itemize}
If track info is not available (due to missing file or format limitations) \note{If track info is not available (due to missing file or format limitations)
the track path will be used instead. the track path will be used instead (except when \setting{Skip if Missing} is selected).}