Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Recent Posts
24
General - (fb2k) / Re: Shaky/unsteady output playing DSD128 files with FB2k version 2.0 32 bit
Last post by JohnMarch -
 ::) Thanks for your suggestion, but that was one of the first things I tried. However, there was one interesting discovery that I'm rather confused about and I probably should have mentioned it before. In the 'components' list in version 1.6.13 there is a Binary Comparator, with a module name of foo_bitcompare, and when I updated to version 2, I was informed that the file was obsolete and should be removed, so I went ahead and deleted it. I subsequently did a "Check for updated components' (in Help) and was informed that 'No updates are available at this time', which I assume means everything was as it should be.
25
3rd Party Plugins - (fb2k) / Re: Library Tree Discussion
Last post by twikaros -
@WilB‍ Thanks for your reaction

Quote
You could try clearing panel properties (backup first if you've made changes you want to keep). If the issue persists, please try and post exact steps to reproduce including any patterns etc. Alternatively, you could: 1) export panel properties from a problematical instance of library tree; 2) import the panel properties into a new library tree panel to confirm that the issue is still present; 3) then if the issue is still present, post the panel properties and I'll take a look.

  • I deleted and re-imported Library-Tree-v2.4.0 - default properties = no problem, my backupproperties = problem occurs
  • I uninstalled Library-Tree-v2.4.0 and imported Library Tree v2.2.0 - default properties = no problem, my backed up properties = problem occurs
  • Did the same after installing SMP v1.6.1 - Hotfix (Initially I used SMP foo_spider_monkey_panel-v1.6.1-mod = problem occurs

Properties attached.

Thanks in advance for all the effort!
27
General - (fb2k) / Python script for transferring ratings from audio metadata to foo_playcount
Last post by bug80 -
After updating to Foobar2000 v2.0 I noticed that foo_playcount is now basically the "default" for storing ratings, so I thought it would be a good time to transfer the ratings from the metadata of all the audio files to a foo_playcount-compatible XML file that can be imported into Foobar.

Usage is really easy: just export your library as XML first (through Library --> Playback Statistics, make sure to check all fields so that it exports all the file paths). Run this script and re-import the resulting XML. Note: I give no guarantees, use at your own risk!

This script was written partly by ChatGPT, partly by me  ;)

Code: [Select]
import os
import xml.etree.ElementTree as ET
from mutagen import File
import numpy as np

def extract_rating(file_path):
    """
    Extracts the rating from the metadata
    """
    audio = File(file_path)
    if 'rating' in audio:
        R = int(float(audio['rating'][0]))
        assert(0 <= R <= 5)
        return R
    return None

def calc_rating(rating):
    """
    foo_playcount stores the 0-5 rating as 'RatingFriendly' and a different
    integer as 'Rating', according to the equation below.
    Source: https://hydrogenaud.io/index.php/topic,85309.msg733606.html#msg733606
    """
    return int(np.round((63.75 + 42.5*(rating-1))))

  
def update_ratings(infile, outfile, folder_path):
    """
    Scans a folder recursively for audio files, extracts ratings and updates
    the XML data.
    """
    tree = ET.parse(infile)
    root = tree.getroot()
    for entry in root.findall('./Entry'):
        item = entry.find('Item')
        file_path = item.get('Path')
        if file_path:
            file_path = os.path.normpath(file_path)
            if any(file_path.lower().endswith(ext) for ext in ('.mp3', '.wav', '.flac', '.aac', '.mp4')):
                print('Scanning {}...'.format(file_path))
                rating = extract_rating(file_path)
                if rating is not None:
                    entry.set('Rating', str(calc_rating(rating)))
                    entry.set('RatingFriendly', str(rating))
    tree.write(outfile, encoding='utf-8', xml_declaration=False)

inxml = 'Library.xml'
outxml = 'Library_ratings.xml'
folder_to_scan = 'H:/MUSIC'

update_ratings(inxml, outxml, folder_to_scan)