Thank you very much, I didn't know there are tools to scrobble manually or by parsing CSV files etc. But I already thought, that MusicBee didn't scrobble the songs because the scrobbles were older than several weeks.
I wrote a small Python script to extract the infos in the MusicBee LastFM Cache and write it into csv, which can be consumed by the tool you mentioned. Everything worked as expected, thank you very much!
If someone is interested in the script, find the source code below:
"""
Python script to extract scrobble information from MusicBee LastFmScrobbleCache.dat file and convert it into csv.
The csv file can then be consumed by the tool "Last.fm Scrubbler".
Author: Selevra
Date: 19.11.22
"""
import csv
from datetime import timedelta, datetime
class MusicBeeCache:
def __init__(self, artist, song, album, album_artist, timestamp, duration_ms):
self.artist = artist
self.song = song
self.album = album
self.album_artist = album_artist
dt = datetime.fromtimestamp(timestamp/1000000000*2)
self.timestamp = dt.strftime('%m/%d/%Y %H:%M')
self.duration = str(timedelta(seconds=int(duration_ms)/1000))
def __str__(self):
return (
f"Artist: {self.artist}\n"
f"Song: {self.song}\n"
f"Album: {self.album}\n"
f"Timestamp: {self.timestamp}\n"
f"Duration: {self.duration}"
)
def to_csv(self):
return [self.artist,self.album, self.song,self.timestamp,self.album_artist,self.duration]
def read_cache_file(path):
with open(path, mode="r", encoding="utf-8") as f:
lines = f.readlines()
lineIdx = 0
entries = list()
while lineIdx < len(lines):
entry = MusicBeeCache(
artist = lines[lineIdx].strip(),
song = lines[lineIdx + 1].strip(),
album = lines[lineIdx + 2].strip(),
album_artist = lines[lineIdx + 5].strip(),
timestamp = int(lines[lineIdx + 6].strip()),
duration_ms = lines[lineIdx + 7].strip(),
)
entries.append(entry)
lineIdx += 9
print(f"Extracted {len(entries)} unscrobbeled songs from cache file")
return entries
def write_to_csv(path, scrobbels):
with open(path, "w", encoding='UTF8', newline='') as f:
writer = csv.writer(f, delimiter=',')
for s in scrobbels:
writer.writerow(s.to_csv())
filepath = "LastFmScrobbleCache.dat"
scrobbels = read_cache_file(filepath)
POSSIBLE_DAYS = 14
start_idx = 0
for idx in range(POSSIBLE_DAYS):
out_filepath = f"csv/out_{idx}.csv"
scrobbles_for_day = int(len(scrobbels) / 14 + 1)
write_to_csv(out_filepath, scrobbels[start_idx:start_idx+scrobbles_for_day+1])
start_idx += scrobbles_for_day + 1
Topic can be closed!
Improvement idea:
Add information to MusicBee lastfm-log file why the cached scrobbles where ignored => they were to old