• 1 Post
  • 152 Comments
Joined 1 year ago
cake
Cake day: June 21st, 2023

help-circle

  • Your state can make laws that are more protective than the federal regulations. California does this frequently. Occasionally, it even trickles to other states because many companies do not want the burden of meeting different state regulations, so they just work with the one that works everywhere (assuming the market is big enough).

    So… What can you do? Well, a month ago, I would have reiterated how important down-ballot voting is, but it’s a little late for that now. The voting populace has spoken.

    Now what you can do is donate to causes that you support. Put pressure on your representatives. Write letters, make calls, etc. It will be exhausting. You will feel like you’re getting nowhere, but you never know what will get through.

    It’s why everyone I know is so upset by the election. Not because “we” lost. That’s sad, but (hopefully) not the end of the world. It’s because we just got signed up for at least four years of constant effort and perpetual vigilance, just to keep the country from falling apart.





  • spizzat2@lemm.eeOPtoPlex@lemmy.ca"Popular" Playlists
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    23 days 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.
    





  • 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.




  • 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.






  • Do you have somewhere I could get more information?

    Most of my video files are mkv, encoded as MPEG, and audio is AC3 5.1, but I’m only playing audio through my TV speakers, so maybe it’s transcoding for my cheap 2-speaker setup? I also typically enable subtitles, which I think can cause transcoding.

    I’ve enabled Direct Stream wherever I could find it, but it didn’t seem to have any effect.


  • What I’d like is the ability to fix out-of-sync audio. My wife won’t watch movies/tv/etc on Plex (on Roku) because some part of it creates an audio delay, and it really bothers her that the audio doesn’t match the lip movement.

    I’ve tried all sorts of settings, both server and client. It mostly only seems to affect my Roku, though, so that seems to be the issue. I just want to add a small video delay or something.