spizzat2

joined 1 year ago
[–] spizzat2@lemm.ee 1 points 1 week ago* (last edited 1 week ago)

Ok, I found a cool resource that gets me a little closer. Someone has a CSV of all Billboard top 100 songs since its inception through the current week. It's about 343k rows (100 rows per week * 52 weeks * ~65 years), so I decided to script the heavy lifting. With a little help from an LLM, I was able to write a Python script that parsed the CSV and then looped over it (see below). Fortunately, my music is fairly well organized, so I was able to use the directory structure to check to see if I had a copy of the song for each of the hits.

With the output of the Python script, I was able to create an m3u playlist, which I can at least open in any decent music player on the same computer as my music. Fortunately, the format of the playlist is dead simple. I just started the file with

#EXTM3U
#EXTINF:-1 tvg-id="US_Billboard" tvg-name="Billboard Top 40 Hits" group-title="US Billboard",Billboard Top 40 Hits

and then added each file as a newline. I'm not sure the second line is even necessary, but it opened in VLC without an issue.

Unfortunately, I've heard that converting/importing an m3u playlist into Plex is not a simple process. You have to query the API and get an ID or manually go to each file and "Get Info". The latter is definitely not practical for the couple thousand matches in my m3u file. I can try to look into querying the API from within the script, but I still don't know the format for the request to add a song to a playlist. If only Python already had everything written for you.

Anyway... I might update if I get further along, but it's not a major priority at the moment. Maybe this will help someone else in the future. I'm just trying to move the sticks.

import os
import csv
import re

def find_files(csv_file, base_directory):
    with open(csv_file, mode='r', newline='', encoding='utf-8') as file:
        reader = csv.reader(file)
        hit_count=0;
        cache = {}
        # Skip header if present
        next(reader, None)  # Uncomment if your CSV has a header
        
        for row in reader:
            if len(row) < 7:
                print(f"Row is incomplete: {row}")
                continue
            
            billboard_week = row[0]  # Date column
            billboard_rank = int(row[1])  # First integer column
            song_name = row[2]  # String to search in filenames
            artist_name = row[3]  # Directory to search in
#NOTE: row[4] might not be an integer, and that causes problems
#  I'm not using these values, anyway.
#            last_week = int(row[4])  # Second integer column
#            peak_position = int(row[5])  # Third integer column
#            weeks_on_chart = int(row[6])  # Fourth integer column
            if re.search("hristmas",song_name):   #Skip "[C|c]hristmas" songs
                continue

            # Construct the full path to the directory
            search_directory = os.path.join(base_directory, artist_name)

            if os.path.isdir(search_directory):
                for root, dirs, files in os.walk(search_directory):
                    for dir in dirs:
                        album_directory = os.path.join(search_directory, dir)
                        if re.search("^[\\.|_]",dir):
                            continue
                        for album_root, album_dirs, album_files in os.walk(album_directory):
                            for file in album_files:
                                if song_name in file:
                                    unique_key = os.path.join(search_directory,song_name);
                                    if re.search("__MACOSX",unique_key):  #Skip weird OSX directory
                                        continue
                                    if unique_key not in cache:
                                        full_path = os.path.join(album_root, file)
                                        print(full_path) #TODO: Print to playlist.m3u file
                                        hit_count=hit_count+1
                                    cache[unique_key]=1
#            else:
#                #print(f"Could not find artist directory: {search_directory}")
        print(hit_count)
# Example usage
if __name__ == "__main__":
    csv_file_path = 'hot-100-current.csv'  # Update this path
    base_directory = '~/Music/'  # Update this path (e.g. 'C:\\Music\')
    find_files(csv_file_path, base_directory)
    os.system("pause")
#How to Use the Script
#
#    Prepare Your CSV File: Ensure it has the correct format: date, Current Rank, Song Title, Artist/Directory name, Previous Rank (1-100, or NA), Peak Rank (1-100), Weeks on Chart (integer).
#    Set the File Paths: Update csv_file_path and base_directory variables with the correct paths.
#    Run the Script: Execute the script in your Python environment. It will print the full paths of matching files to the console.
#
#Notes
#
#    This script assumes that the directory name in the CSV corresponds to a subdirectory of the specified base_directory.
#    It handles the case where the directory does not exist and will skip any rows that do not have the correct number of columns.
#    Adjust the path separators as necessary based on your operating system. In this case, it uses double backslashes (\\) for Windows paths.
#TODO:
#    Better artist handling (Look for "Featuring" or "&" to better find artists. Make artist search case-insensitive)
#    Automatically generate playlist file by writing directly to playlist.m3u instead of printing to console.
#    Incorporate Python libraries to query Plex API for song information and create/update a playlist.
#    Accept filter parameters to only include songs from a given date range.
 

Does anyone have any thoughts or suggestions on how to create a playlist of songs from my library that have been released as "singles" or "Top 40s" across a time period?

Let's say I wanted to throw a 90s party, and I wanted to create a playlist from my library using only songs that people are likely to know. I recognize that's totally subjective, so maybe that's why I'm struggling to find what I want. I can create a playlist based on album release date, which gets me a bit of the way there, but the playlist is going to include a lot of "deep cut" tracks and whole albums that few people know. I'd rather not spend too long curating the list. I was hoping for a way to just find popular tracks, and it seems like basing it on "chart toppers" would be a good place to start. Ideally, it would be genre-independent, but limited to songs that got decent radio play, so Backstreet Boys to Korn to Shania Twain are fine. Yo Yo Ma maybe not so much.

It doesn't seem like Plex has information available in the filters to achieve that. It does have "Popularity" as an additional column header if I list my music by "Tracks", so I guess I could sort by that and limit the results to some value. It feels a little clunky, though, and I'm not sure where it's getting that information.

I know that Library Radio is a thing, but I can't seem to make it do what I want. I only have 4 stations on the web interface: "Library Radio", "Deep Cuts Radio", "Time Travel Radio", and "Random Album Radio". Clicking on them just starts playing music from a wide selection that I have no control over. I know that "Decade Radio" exists, but it doesn't seem to be giving me what I want, either. It frequently pulls instrumental tracks from movie soundtracks. I have "Smart Shuffle" enabled on my server. I'm not sure if that's helping or hurting my experience (I've seen some very mixed reviews on that feature). I also can't find "Decade Radio" on the web interface; it seems like Decade Radio is only available on Plexamp.

I'd rather just create a playlist. That way it would be available everywhere, and I could tailor it a little bit, if needed.

So, yeah... any tips? It seems like the "filter by decade, sort by popularity, and limit by count" might be my best option right now.

[–] spizzat2@lemm.ee 2 points 2 weeks ago* (last edited 2 weeks ago)
[–] spizzat2@lemm.ee 4 points 2 weeks ago

but be against assisted suicide

No free hand outs! You gotta work for your death!

/s

[–] spizzat2@lemm.ee 3 points 3 weeks ago

In my state

Is it the state of Chaos?

[–] spizzat2@lemm.ee 16 points 1 month ago* (last edited 1 month ago)

Yeah, I definitely remember when they started showing things I didn't ask for, and I thought "I don't like that", but I stuck around because I could ignore posts I didn't care about.

It took a little while, but I eventually started to play "how far can I scroll before I get something I didn't ask for?"

Shortly after that, I realized I actually had to start playing "how far until I get something I did ask for?".

Once I realized that, I cut back significantly. I still go from time to time when I'm stuck waiting in line or something, but it broke my daily habit. I miss what it used to be, but I certainly don't miss what it is.

[–] spizzat2@lemm.ee 3 points 1 month ago* (last edited 1 month ago) (1 children)

How do you define "compete"?

Here they are on opposite corners of the same intersection.

Sure, that's only one example, but I'm not sure how well I can Google "Kroger near an [Albertsons|Randalls|Safeway]" to find a list.

[–] spizzat2@lemm.ee 53 points 1 month ago (5 children)

The transition from analog to digital really hurt my desire to watch OTA TV (you caught me! I'm not under 25).

With analog broadcast, any weak signal or interference produced a little bit of static, but you could still see and hear what was being said. With digital, any weak signal means dropped frames and silence or weird glitches. You completely lose what's happening. Even with a powered antenna, I have frequent issues with weak signal. I could probably try to get a rooftop antenna installed, but there's no guarantee it would be any better. It's just easier to find other entertainment at this point.

[–] spizzat2@lemm.ee 1 points 1 month ago* (last edited 1 month ago)

I did some testing, and it turns out I did not have Direct ~~Stream~~ Play forced. I think I enabled it at one point, but I didn't see much difference on the "worst case scenario" video I was testing with, so I turned it back off. Looking at the Dashboard page, I can see that, even with the setting forced, that particular video is still transcoding video from MPEG2VIDEO to H264, and audio from AC3 5.1 to AAC. I may have to look into re-encoding that particular series, though the files for that show should have followed the same process as most of my other files, so I'm not sure why they're different.

Some other videos that I tested did show improvements when forcing Direct Play, but the Dashboard still shows transcoding (hw) video from H.264 to H264 (note the missing period) and transcoding audio from DTS-HD MA 5.1 to AC3.

As far as my TV setup, I don't have external speakers. I'm essentially feral, and I don't feel like they're worth it in most situations. The built-in TV speakers get loud enough, and sound fine to me. I'd rather not have to defend that setup, so hopefully no one comes at me for that unless it's actually responsible for the audio delay.

[–] spizzat2@lemm.ee 20 points 1 month ago (4 children)

"Roe v. Wade is settled law. They just use the issue to rile up their base. They'd never overturn it!" and other lies we tell ourselves...

[–] spizzat2@lemm.ee 1 points 1 month ago

Do you have a way to do that? I don't see any settings that allow that, which is why I posted.

Or did you mean just re-encode all of my video files with a delay to fix the one device that has an issue?

[–] spizzat2@lemm.ee 16 points 1 month ago

Keep in mind that many red states have attempted to essentially ban online porn with their overbearing age-verification laws. A savvy internet user would be less likely to pick an exit node in a red state, given the choice.

view more: next ›