[-] sabreW4K3@lemmy.tf 29 points 8 months ago

Do you really think generic Linux phones will ever be a thing? The people go where the apps are and there's no reason for the most popular apps to make generic Linux apps. Just the idea of mobile Flatpaks makes me nauseous.

-30
submitted 9 months ago by sabreW4K3@lemmy.tf to c/android

Cross posted from: https://lemmyf.uk/post/5106939

15
submitted 9 months ago by sabreW4K3@lemmy.tf to c/fuck_cars@lemmy.ml

I love it when I see cities, towns and villages putting real effort into non car infrastructure.

10
submitted 9 months ago by sabreW4K3@lemmy.tf to c/raspberrypi@lemmy.ml

Does anyone know of and can recommend something I can install that will give me stats like temperature, power consumption, memory utilisation and processor utilisation?

8
submitted 9 months ago by sabreW4K3@lemmy.tf to c/docker@programming.dev

I just installed Immich and while all my other containers have just required me to add to them to existing yaml, Immich requires its own yaml. That's fine I guess, but for the library, I wanna host it on my NAS and so I made the volume in my main Docker-Compose.yaml, the Immich yaml was all like, "what you talking about Willis?" because in my Immich environment I tried to point to something created in my main yaml. I thought I could work around this by adding an empty volume declaration, but now I can't find my uploads 😂 any idea on the correct methodology/workaround?

8
submitted 9 months ago by sabreW4K3@lemmy.tf to c/selfhosted@lemmy.world

I'm having a problem with one of the apps that interacts with something I'm hosting. Alternative apps aren't having the same problem and neither is the webpage UI. Having purchased the app, I emailed the developer for some help and they said they didn't know what the issue was and that it could probably fix it if they could access my server. I'm not really comfortable with that though. Should I be?

7

As a Home Assistant noob, there's some things that I'm just destined not to learn until I experience them and one such thing is that I should disable things I don't use on devices I use. I have a bunch of presence sensors in my house and they were essentially spamming my logs with the motion state, something I never need as I only ever need to know whether a room is occupied or not.

Anyway, I didn't think anything of the log spam until I did a backup, in two weeks my backup went from 5mb to 0.5gb I was like WTF? I digress... a quick search said it was safe to delete and it would be recreated automatically, so I did and now it's back to 5mb and obviously I disabled all of the extraneous logging elements disabled. Since disabling wasn't enough.

Just sharing what I learned.

137
9
submitted 9 months ago* (last edited 9 months ago) by sabreW4K3@lemmy.tf to c/navidrome@discuss.tchncs.de

What?

Hello everyone, you may know me from films such as... Kidding. But hello nonetheless, today I'm releasing the culmination of all of my recent sleepless nights.

This simple script scans the location of your Navidrome music collection, pulls the embedded rating and then adds that rating to your Navidrome account

Code

v 0.3: Not only was the last version hideous, it was inconsistent. Stuff that worked in single directory mode never worked in full mode. Also removed some print statements, cleaned up some others.

import os
import mutagen
import requests
import urllib.parse
import json
import sys
import glob
from mutagen.id3 import ID3
global rating
global track_id

# Navidrome credentials
script_name = "ImportClementineRatings"
navidrome_url = "your-navidrome-server:port"
navidrome_username = "your-navidrome-username"
navidrome_password = "your-navidrome-password"
headers = None

# Directory containing MP3 files
mp3_directory = "your-collection-relative-to-this-script"

# Single Directory Mode
if len(sys.argv) > 1:
  for arg in sys.argv:
    #print(arg)
    #if arg != "import_ratings.py":
    if arg != os.path.basename(__file__):
      mp3_directory = "/".join([mp3_directory,"Collection",arg])

def extract_rating(mp3_file):
    audio = mutagen.File(mp3_file)
    tags = ID3(mp3_file)
    if "TXXX:FMPS_Rating_Amarok_Score" in tags:
      rating = tags["TXXX:FMPS_Rating_Amarok_Score"]
    else:
      print(" ".join(["No rating exists for",mp3_file,"this song"]))
      rating = None

    if (rating != None):
      sanerating = float(str(rating))
    else:
      sanerating = float(0)

    if sanerating >= 1.0:
      return 5
    elif sanerating >= 0.8:
      return 4
    elif sanerating >= 0.6:
      return 3
    elif sanerating >= 0.4:
      return 2
    elif sanerating >= 0.2:
      return 1
    else:
      return 0

def update_rating_on_navidrome(track_id, rating):
    hex_encoded_pass = navidrome_password.encode().hex()
    #print(rating)
    if rating != 0:
      url = f"{navidrome_url}/rest/setRating?id={track_id}&u={navidrome_username}&p=enc:{hex_encoded_pass}&v=1.12.0&rating={rating}&c={script_name}"
      response = requests.get(url)
      print(f"Success!")

def find_track_id_on_navidrome(mp3_file):
    track_id = None

    # Remove File Extension
    song = mp3_file.rsplit(".",1)[0]

    # Fetch Song Artist From Filename
    songartist = song.split(" - ")[0]
    songartist = songartist.split("/")[-1]

    # Fetch Song Title From Filename
    index_var = 1
    if 0 <= index_var < len(song.split(" - ")):
      songtitle = song.split(" - ")[1]
    else:
      return None
      
    #songtitle = urllib.parse.quote(songtitle)
    hex_encoded_pass = navidrome_password.encode().hex()

    if len(songtitle) < 2:
      return None
    else:
      #print(songtitle)
      songtitle = song.split(" - ")[1]
      songtitle = urllib.parse.quote(songtitle)

    url = f"{navidrome_url}/rest/search3?query={songtitle}&u={navidrome_username}&p=enc:{hex_encoded_pass}&v=1.12.0&c={script_name}&f=json"
    data = None

    response = requests.get(url)
    parsed = json.loads(response.content)
    print(f"Debug URL: {url}")
    if "subsonic-response" in parsed:
      parsed = parsed["subsonic-response"]
      if "searchResult3" in parsed:
        parsed = parsed["searchResult3"]
        if "song" in parsed:
           for match in parsed["song"]:
             special_characters = ":?*"
             if any(character in special_characters for character in  match["artist"]):
                match["artist"] = match["artist"].translate({ord(c): "_" for c in special_characters})

             if (match["artist"] == songartist):
               parsed = match
               track_id = match["id"]

    songtitle = urllib.parse.unquote(songtitle)
    if response.status_code == 200:
        if track_id:
          print(f"Track successfully identified: {songtitle}: {track_id}")
          return track_id
        else:
          print(f"Could not find {songtitle} track") 
          return None
    else:
        print(f"Failed to identify track {songtitle}: {response.text}")
        return None

def process_file(mp3_file, folder):
  track_id = "fail"

  mp3_file = "/".join([folder, mp3_file])
  rating = extract_rating(mp3_file)
  track_id = find_track_id_on_navidrome(mp3_file)

  if track_id != "fail":
    try:
      update_rating_on_navidrome(track_id, rating)
    except:
      print(f"Failed to set rating for {file}")

notmusicext = ("DS_Store","jpg", ".JPG", ".jpeg", ".JPEG", ".mood", ".m3u", ".nfo", ".png", ".PNG", ".sfv", ".url")

for foldername in os.listdir(mp3_directory):
  if foldername.endswith(".mp3"):
    process_file(foldername, mp3_directory)
    folderpath = mp3_directory
  elif foldername.endswith(notmusicext):
    print(f"Skipping: {foldername}")
  else:
    folderpath = "/".join([mp3_directory, foldername])
  #for filename in glob.iglob(mp3_directory + "*.mp3", recursive=True):
  #can't get this to work
    #would do stuff here
    print(f" Debug: folderpath")

    for filename in os.listdir(folderpath):
      if filename.endswith(".mp3"):
        process_file(filename, folderpath)
      elif filename.endswith(notmusicext):
        print(f"Skipping: {filename}")
      else:
        foldername2 = "/".join([folderpath,filename])
        for filename2 in os.listdir(foldername2):
          if filename2.endswith(".mp3"):
            if filename2.startswith("A") == False:
              process_file(filename2, foldername2)
          elif filename2.endswith(notmusicext):
            print(f"Skipping: {filename2}")
          else:
            print(f"What is: {filename2}")

print("Done!")

Usage

Copy the code block, create a Python script in your chosen directory and then run it.

Thanks

This truly would not be possible without the Fediverse community, especially the Lemmy community. So thank you everyone but especially

@Deebster@programming.dev @ggwithgg@feddit.nl @jnovinger@programming.dev @ishanpage@programming.dev @rglullis@communick.news @oscar@programming.dev @TootSweet@lemmy.world @sabret00the@mas.to @amcewen@mastodon.me.uk @oblomov@sociale.network @mdylanbell@fosstodon.org @mborous@mastodon.social @cohomologyisFUN@mastodon.sdf.org @eichin@mastodon.mit.edu @mdione@en.osm.town

For some of you what you did seemed so small, but it was massive to me and I'm incredibly grateful for your kindness.

The Lore

One day, one man decided that enough was enough, it was time to move to the modern age, but to get there he needed his music collection. However it wasn't enough to just have the music, he needed the ratings too. First world problems, I know! So with nothing but hope, he said out in search of the ring! I mean the script! He couldn't find the script, but Deebster offered to help and so the two of them embarked on a journey whereby I kept pasting stuff to Desbster and he was like "no" but under his guidance, my script born from the embers of Bard, started taking shape. Now, for me with zero Python experience, you can imagine that the guidance I required was a lot, but Deebster earned his Scout badge in guidance. And as I got closer and closer, I kept cutting my sleep short so that I could spend some extra time trying to figure it out. Also huge thanks to Minz from the Navidrome discord as they came in clutch with some API advice. Anyway, I got a working script and I'm paying it forward by sharing it. Thank you all again.

Anything Else

If you can see how I should improve this, please let me know. Thank you all again.

-10
submitted 9 months ago by sabreW4K3@lemmy.tf to c/privacy@lemmy.ml

Cross-post!

-3
submitted 9 months ago by sabreW4K3@lemmy.tf to c/android

Not sure if it's any good since I haven't tried it, but it's now a thing and an option.

20
submitted 9 months ago by sabreW4K3@lemmy.tf to c/homelab@lemmy.ml

Having got my Raspberry Pi for Christmas, I was finally able to enter the world of home labs and I'm slowly getting everything up and running.

That said, one thing I was super excited about but hasn't come to fruition was Pi-Hole. That's for two reasons, one my Pi isn't hardwired into the router and two my router kinda sucks (Virgin Media Hub 5).

So I came here to ask for recommendations for a router. One that would allow me to run vLANs and use my Pi for adblocking. Honestly the advice I got was like fire and I was like water.

I wanted a simple cheap solution and everyone was like just spend 🥺

Eventually though, my ignorance waned and I started looking into what the suggestions were, which was essentially buy an N100 Firewall Mini PC with 4 Ethernet Port, load up PFSense or OpenWRT, then buy an Access Point, connect it and profit.

So with my dreams of a £50 plug and play experience down the drain, can someone explain to me how it all works? Why is this the suggestion? My Pi is kinda set and leave. My NAS is set and leave, will a firewall PC be the same? Also why a firewall PC over a second Pi?

34
submitted 9 months ago by sabreW4K3@lemmy.tf to c/uk_politics@feddit.uk
[-] sabreW4K3@lemmy.tf 30 points 11 months ago

I'm certainly rooting for Naveen and wishing him the best of luck. Hopefully he can make the apps his own and take them to new heights, it helps that they're all pretty much feature complete.

[-] sabreW4K3@lemmy.tf 30 points 11 months ago

Sorry to hijack your meme thread, but would you mind teaching me the difference between the three and why your preference is what it is?

Also, kinda bonus question, the use cases I've seen for WebDAV in my daily life is for library and progress synchronization in Legado and Moon+ Reader, does that differ from using RSync etc?

[-] sabreW4K3@lemmy.tf 31 points 11 months ago

This is bloody excellent. Template please

[-] sabreW4K3@lemmy.tf 34 points 11 months ago

That's called an inconvenient truth. The fact of the matter is, if piracy was eradicated, concerts would be near empty and no one would know the music. Films that don't leak don't generally do as well unless you count blockbusters and even then, take Spider-Man, even if people pirate, fans will go and see it a few times. The problem isn't the piracy, it's that they can't profit off of it directly.

[-] sabreW4K3@lemmy.tf 32 points 1 year ago

Instance browsing isn't implemented yet

[-] sabreW4K3@lemmy.tf 29 points 1 year ago
[-] sabreW4K3@lemmy.tf 34 points 1 year ago

I believe Dessa said during the AMA that he's working on it.

[-] sabreW4K3@lemmy.tf 30 points 1 year ago

File a bug for reject all.

[-] sabreW4K3@lemmy.tf 32 points 1 year ago

Capitalism is shit. We're brainwashed to believe that there's only so much and we have to get as much as can and before everyone else, damn the cost, even if it's our mental health. I don't understand how we can't look at it from the other angle and say, if there's only so much, let's protect it. Let's share what we have so everyone can have fun. Let's care about everyone and lift everyone up.

[-] sabreW4K3@lemmy.tf 31 points 1 year ago

I think even before that, there were major issues. The pandemic just made it so we couldn't ignore them any longer. Which is ridiculous given how much people were acting out. But now everyone is aware of how important it is, because so many were trapped with their own thoughts and/or monotony. Even so, our governments paid lip service and then failed to make meaningful changes. My government cares more about getting people back into the office than making sure mental health care is accessible to everyone.

[-] sabreW4K3@lemmy.tf 32 points 1 year ago
view more: ‹ prev next ›

sabreW4K3

joined 1 year ago
MODERATOR OF