Category: Tutorial

Using eyeD3 to change a bunch of mp3’s information in bulk.

I needed to modify a ton of mp3 files today, and thought I would document it for me, and, for you.

rename all files based on id3 tags ** use with caution

eyeD3 --rename '$artist - $album - $title' *.mp3

RENAME ALL FILES IN ALL SUB DIRS BASED ON FILE NAME ** use with caution

find . -name \*.mp3 -execdir eyeD3 --rename '$artist - $album - $title' *.mp3 {} \;

DELETE FILES OF SPECIFIC TYPE AND DOTFILES

find . -type f -name ".*" -delete
find . -type f -name "*.m3u" -delete
find . -type f -name "*.nfo" -delete
find . -type f -name "*.sfv" -delete
find . -type f -name "*.zip" -delete

SET ALL TAGS TO ID3 Version 2.4

find . -name \*.mp3 -execdir eyeD3 --to-v2.4 {} \;

REMOVE GENRE AND COMMENTS FROM ALL FILES

find . -name \*.mp3 -execdir eyeD3 --genre= --remove-object Comments {} \;

SET ALL GENRES TO A SPECIFIC GENRE (SEE BELOW FOR LIST)

find . -name \*.mp3 -execdir eyeD3 --genre "Drum & Bass" {} \;
find . -name \*.mp3 -execdir eyeD3 --genre "Breakbeat" {} \;
find . -name \*.mp3 -execdir eyeD3 --genre "Rock" {} \;

RUN DETOX TO RENAME ALL FILES (AS A TEST RUN)

detox -n -r -v -s utf_8 /mnt/gluster/Music

ACTUALLY RUN DETOX TO RENAME ALL FILES

detox -r -v -s utf_8 /mnt/gluster/Music

RENAME ALL РTO _ USING RENAME 

find . -name \*.mp3 -exec rename - _ '{}' \;

GENRES

# eyeD3 --plugin=genres

  0: Blues                               96: Big Band
  1: Classic Rock                        97: Chorus
  2: Country                             98: Easy Listening
  3: Dance                               99: Acoustic
  4: Disco                              100: Humour
  5: Funk                               101: Speech
  6: Grunge                             102: Chanson
  7: Hip-Hop                            103: Opera
  8: Jazz                               104: Chamber Music
  9: Metal                              105: Sonata
 10: New Age                            106: Symphony
 11: Oldies                             107: Booty Bass
 12: Other                              108: Primus
 13: Pop                                109: Porn Groove
 14: R&B                                110: Satire
 15: Rap                                111: Slow Jam
 16: Reggae                             112: Club
 17: Rock                               113: Tango
 18: Techno                             114: Samba
 19: Industrial                         115: Folklore
 20: Alternative                        116: Ballad
 21: Ska                                117: Power Ballad
 22: Death Metal                        118: Rhythmic Soul
 23: Pranks                             119: Freestyle
 24: Soundtrack                         120: Duet
 25: Euro-Techno                        121: Punk Rock
 26: Ambient                            122: Drum Solo
 27: Trip-Hop                           123: A Cappella
 28: Vocal                              124: Euro-House
 29: Jazz+Funk                          125: Dance Hall
 30: Fusion                             126: Goa
 31: Trance                             127: Drum & Bass
 32: Classical                          128: Club-House
 33: Instrumental                       129: Hardcore
 34: Acid                               130: Terror
 35: House                              131: Indie
 36: Game                               132: BritPop
 37: Sound Clip                         133: Negerpunk
 38: Gospel                             134: Polsk Punk
 39: Noise                              135: Beat
 40: AlternRock                         136: Christian Gangsta Rap
 41: Bass                               137: Heavy Metal
 42: Soul                               138: Black Metal
 43: Punk                               139: Crossover
 44: Space                              140: Contemporary Christian
 45: Meditative                         141: Christian Rock
 46: Instrumental Pop                   142: Merengue
 47: Instrumental Rock                  143: Salsa
 48: Ethnic                             144: Thrash Metal
 49: Gothic                             145: Anime
 50: Darkwave                           146: JPop
 51: Techno-Industrial                  147: Synthpop
 52: Electronic                         148: Abstract
 53: Pop-Folk                           149: Art Rock
 54: Eurodance                          150: Baroque
 55: Dream                              151: Bhangra
 56: Southern Rock                      152: Big Beat
 57: Comedy                             153: Breakbeat
 58: Cult                               154: Chillout
 59: Gangsta Rap                        155: Downtempo
 60: Top 40                             156: Dub
 61: Christian Rap                      157: EBM
 62: Pop / Funk                         158: Eclectic
 63: Jungle                             159: Electro
 64: Native American                    160: Electroclash
 65: Cabaret                            161: Emo
 66: New Wave                           162: Experimental
 67: Psychedelic                        163: Garage
 68: Rave                               164: Global
 69: Showtunes                          165: IDM
 70: Trailer                            166: Illbient
 71: Lo-Fi                              167: Industro-Goth
 72: Tribal                             168: Jam Band
 73: Acid Punk                          169: Krautrock
 74: Acid Jazz                          170: Leftfield
 75: Polka                              171: Lounge
 76: Retro                              172: Math Rock
 77: Musical                            173: New Romantic
 78: Rock & Roll                        174: Nu-Breakz
 79: Hard Rock                          175: Post-Punk
 80: Folk                               176: Post-Rock
 81: Folk-Rock                          177: Psytrance
 82: National Folk                      178: Shoegaze
 83: Swing                              179: Space Rock
 84: Fast Fusion                        180: Trop Rock
 85: Bebob                              181: World Music
 86: Latin                              182: Neoclassical
 87: Revival                            183: Audiobook
 88: Celtic                             184: Audio Theatre
 89: Bluegrass                          185: Neue Deutsche Welle
 90: Avantgarde                         186: Podcast
 91: Gothic Rock                        187: Indie Rock
 92: Progressive Rock                   188: G-Funk
 93: Psychedelic Rock                   189: Dubstep
 94: Symphonic Rock                     190: Garage Rock
 95: Slow Rock                          191: Psybient

Using two ODROID HC2’s to create a small NAS with GLUSTERFS for PLEX server

My Mac Mini acting as a PLEX server was from late 2009 and had began stuttering when playing some recent high quality rips or transcoding.

It was time to upgrade.

Luckily I had an old i7-4790K processor laying around. I bought a case from amazon, and sourced a cheap 1150 motherboard locally. I also already had a 250gb SSD I wasn’t using. All I needed was some ram and I was in business.

I also wanted some form of storage and had heard about the ODroid HC2. I picked up the following gear from their site which came surprisingsly fast via DHL (a few days).

Then, from Amazon I picked up everything else.

Once I had everything wired up, and running I booted to the default OS using the DHCP addresses they got. Then I changed the IP to something static DHCP on my dhcp server, then added DNS through PFsense so my shared drives would be resolvable by name. Shit’s gettin’ real now dawg.

Then, I performed the following steps to get everything going.

  1. Install Arch Linux on Plex Server and configure (this would be a separate howto entirely). Install Plex Server or PlexPass Server.
  2. Plug your Odroids in, and get them on the network.
  3. SSH to both Odroids and then issue these commends on each one.
    # passwd
    # sudo apt-get install glusterfs-server
    # sudo service glusterfs-server start
    # sudo service glusterfs-server status
    # sudo apt-get install xfsprogs
    # gdisk /dev/sda
    
    p
    d
    n
    <enter><enter><enter><enter>
    w
    y
    
    # sudo mkfs.xfs /dev/sda1
    # sudo mkdir /data
    # sudo mount /dev/sda1 /data/
    # df -T
    # blkid /dev/sda1
    
    UUID=1234abc
  4. Now you’ll want to run the following differently on each odroid.
    droid1:
    echo "UUID=1234abc /data xfs defaults 1 1" | sudo tee --append /etc/fstab
    
    droid2:
    echo "UUID=5678xyz /data xfs defaults 1 1" | sudo tee --append /etc/fstab
  5. Then run these commands on both odroids
    # mount -a 
    # df -T
    # sudo mkdir -p /data/vol0
  6. Now run this on just one of the Odroids. Logically, I chose to do it on odroid1. Where mylocal.lan is my domain I use on pfsense.
    # sudo gluster peer probe droid2.mylocal.lan 
    # sudo gluster peer probe droid1.mylocal.lan
    # sudo gluster volume create vol0 replica 2 transport tcp droid1.mylocal.lan:/data/vol0 droid2.mylocal.lan:/data/vol0
    # sudo gluster volume info vol0
    # sudo gluster volume start vol0
  7. Then on your PLEX server, run these commands to mount up your gluster network, and auto mount it.
    # sudo mkdir -p /mnt/gluster 
    # sudo mount -t glusterfs -o acl droid1.mylocal.lan:/vol0 /mnt/gluster
    # df -hP /mnt/gluster
    # cat /proc/mounts
    # echo "droid1.mylocal.lan:/vol0 /mnt/gluster glusterfs defaults,_netdev,noauto,x-systemd.automount 0 0" | sudo tee --append /etc/fstab
  8. Now add some files to your gluster drive on the plex server. Then take a look at both your odroids. You should see the file exists in /data/vol0 as well on each of them. Congratulations you now have a replicating filesystem spread out over your two Odroids and used by Plex for storage.
  9. Now you should reboot all three devices to make sure everything comes up on a reboot, and that everything still functions. If it doesn’t check your logs and repeat anything above.

Here she is in all it’s glory on my Lack-Rack (heh).

 

Radeon RX 580 on Hackintosh OSX 10.13.4 Automatically Rotate Screen on Boot

Recently I got an ASUS Radeon RX 580 to replace an NVidia Card I was tired of fighting and trying to make work properly. As it turns out, no video card is very easy to get working with Hackintosh!

Anyway, today the problem was after finally getting two monitors working the secondary monitor was booting with a weird rotation and was a pain in the ass to change each time I logged in because the mouse was about 5″ off location on that screen.

There must be a way to automate it, thought I.

Here’s how I did it.

# cd ~/Documents/Source
# git clone https://github.com/CdLbB/fb-rotate.git
# cd fb-rotate
# gcc -w -o fb-rotate fb-rotate.c -framework IOKit -framework ApplicationServices
# nano /Users/YOURUSERNAME/Library/LaunchAgents/com.YOURCOMPUTERNAME.fb-rotate.plist

put this

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
 <key>Label</key>
 <string>com.YOURUSERNAME.fb-rotate</string>
 <key>ProgramArguments</key>
 <array>
 <string>/Users/YOURUSERNAME/Documents/Source/rotate.sh</string>
 </array>
 <key>RunAtLoad</key>
 <true/>
</dict>
</plist>

then get the list of your screens

# /Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -l

Which will output something like this

Display ID Resolution
 0xb430e32 1920x1080 [main display]
 0x2b287c4c 1200x1920

Take note of the screen you want to automatically rotate on boot. Copy the 0x00000 number.

# nano ~/Documents/Source/rotate.sh

And put fb-rotate command into the file

/Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -d 0X_YOURIDHERE -r 0
/Users/YOURUSERNAME/Documents/Source/fb-rotate/fb-rotate -d 0X_YOURIDHERE -r 270

then make it executable

chmod +x ~/Documents/Source/rotate.sh

Now on your next reboot, it should auto flip your monitor the orientation you want. Obviously not a super elegant solution, but, whatever it’s done right, and, it work

If you want to test your scripts here they are testing:

to load:

launchctl load com.YOURUSERNAME.fb-rotate

to unload:

launchctl unload com.YOURUSERNAME.fb-rotate.plist