Friday, February 19, 2021

Linux script to display Some information of MP3 files

 The following bash script utilizes mediainfo command line to retrieve various metadata inside an MP3 (or any media file, in fact):


#!/bin/sh

i=0
for f in "$@"
do
    i=$((i+1))
    printf "%d," $i
    mediainfo --Inform="General;%CompleteName%,%Format%,%OverallBitRate_Mode%,%BitRate%,%FileSize/String4%" "${f}"
done





For example (I put the above into a script named 'bitrate.sh'):

$ bitrate.sh *.mp3
1,01_-_bohemian_rhapsody_-_queen_-_greatest_hits_cd1.mp3,MPEG Audio,CBR,256000,10.94 MiB
2,05_-_bicycle_race_-_queen_-_greatest_hits_cd1.mp3,MPEG Audio,CBR,256000,5.612 MiB
3,07_-_it's_a_hard_life_-_queen_-_greatest_hits_cd2.mp3,MPEG Audio,CBR,256000,7.620 MiB
4,09_-_who_wants_to_live_forever_-_queen_-_greatest_hits_cd2.mp3,MPEG Audio,CBR,256000,9.075 MiB
5,11_-_the_miracle_-_queen_-_greatest_hits_cd2.mp3,MPEG Audio,CBR,256000,9.002 MiB
6,15_-_friends_will_be_friends_-_queen_-_greatest_hits_cd2.mp3,MPEG Audio,CBR,256000,7.599 MiB
7,16_-_the_show_must_go_on_-_queen_-_greatest_hits_cd2.mp3,MPEG Audio,CBR,256000,8.048 MiB
8,16_-_we_will_rock_you_-_queen_-_greatest_hits_cd1.mp3,MPEG Audio,CBR,256000,3.741 MiB
9,17_-_we_are_the_champions_-_queen_-_greatest_hits_cd1.mp3,MPEG Audio,CBR,256000,5.542 MiB


The output is in CSV, suitable to be imported as a table in spreadsheet.

Sunday, December 20, 2020

Plex Server inaccessible with LG TV nor Ipone

 I recently had access issue to my Plex server (running on Linux).  It was fine sometime ago, but lately everytime I tried to access it from my LG TV or my phone, they said the server was offline. I'd followed various instructions and troubleshooting I found on the Internet with no luck.  Here is the list of steps I did:

  • Ensure no VPN running on all devices and server
  • Select "Preferred" for secure connection
  • Added my private subnet in the "List of IP addresses and networks that are allowed without auth"
  • Upgrade the Plex server to the latest
  • Restart the server (e.g., "sudo service plexmediaserver restart")
  • Verify I am able to access the server through its IP (e.g, http://192.168.1.103:32400)
  • Enable DLNA server
  • Revert the Plex on TV to last publicly available version
  • Power down TV, wait 2 minutes and turn it back on

Turned out it was due to IPv6 connection was enabled on the Plex server! Once I disabled it, now I could watch my movies or stream my music to other devices.  My LG TV apparently did not support IPv6 yet.

Saturday, November 14, 2020

My Indentation configuration

 The content of $HOME/.indent.pro:


-as

-lp

-bad

-bap

-bbb

-bbo

-bli0

-nbc -c33 -cd33 -ncdb -nce -ci4 -cli0

-c4

-ncdw

-cp33 -cs -d0 -di1 -nfc1 -nfca -hnl -i8 -ip0 -l75 -lp -npcs

-nprs -npsl -saf -sai -saw -nsc -nsob -nss

-v