Pauly's Soapbox

Home

Looking for something on my site? Not found it? Try here:

Sync a selection of mp3s to my android phone with linux

Apr174/17
Hmm why can I not find anything to do this?

I want to sync my music to my phone, or to a usb key that I can use in the car. But not all of it I just don't have room. I like to play my music on shuffle mostly, so a randomised selection is good, with the higher rated tracks more likely to be on the list.

Here's my work in progress:

#!/bin/bash
# Pick a random selection of mp3s to sync to my phone

WEIGHTING=100 # no tracks rated less than this
UNWEIGHTING=30 # higher number makes it less likely we'll pick any file
MIN=`expr 1 + ${WEIGHTING}`
MAX=`expr 255 + ${UNWEIGHTING}`
RAND=`shuf -i ${MIN}-${MAX} -n 1 2> /dev/null` # debian only?
# RAND=`jot -r 1 ${MIN} ${MAX}` # osx only?
IGNORE=/tmp/sync.ignore.txt
if [ $# == 3 ]
then
POPM=`mid3v2 "$1" | grep POPM`
RATING=`echo ${POPM} | cut -d' ' -f2 | cut -d/ -f1 | bc`
[ "${RATING}" == "" ] && exit 1
if [ ${RAND} -lt ${RATING} ]
then
echo cp "$1" "$3" # ${RAND} < ${RATING}
else
echo "$1" | sed -e "s|$2||" >> ${IGNORE} # ${RAND} > ${RATING}
fi
exit 0
fi
if [ $# == 2 ]
then
echo "" > ${IGNORE}
# blog formatting is removing the backslash before the ; here lookout
find "$1" -name "*.mp3" -exec $0 {} "$1" "$2" ;
rsync -rOutz "$1" "$2" --exclude-from ${IGNORE} --delete
exit 0
fi
echo "usage $0 [source] [destination]"



So save that as say *syncMP3s*, plug your phone into your linux computer and see it mount as say /media/phone and then run

syncMP3s ./Music /media/phone/Music


I'll put this in a repo, you're missing some backslashes from there in the *find* command...

Still a work in progress.
:: Comment / reply

We are a one car family again

Apr164/16
Katie has been collected by the hire company. Our free extra car, is no more. I say free, I ended up paying out a good six grand over this insurance lark, but we did get to drive a nice new high spec car for a while. So long Katie, it was nice driving your.

Taking our new car on a trip to France soon, booked up the eurotunnel today. Just a day trip, to cite europe, stock up on wine and mustard and chocolate.

Working from home today. Going to work out on the balcony for a bit just because it's nice still.
:: Comment / reply

Cool lego trains

Apr144/14
Recommended / related


All automated with arduino.

Glossary:

arduino: arduino is open source hardware prototyping, it's how I do my diy electronics
:: Comment / reply

I needed to win the premium bonds again

Apr134/13
And I did win the premium bonds again!

I had to sell a stack of premium bonds in order to buy the new car. I couldn't get hold of my money right away as it was so close to the next draw, so this meant all my car money was in the draw one last time... Surely there should be some sort of payback here, and I would freakily win the value of the car back or something?

Not quite, but I did win £25. That's two months in a row now. I have set the winnings up to reinvest automatically, so the pot is building again...

Just banked the £850 that I got as an insurance settlement for the old car back into premium bonds, so I'm fully expecting to win again next month.

The nsandi.com website is still dreadful, the whole "security" experience is ridiculous and painful, and less secure than a simpler system would be.
:: Comment / reply

Local people solving local issues

Apr134/13
:: Comment / reply

So long Katie

Apr134/13
Katie is our Peugeot 208 hire care we got on the insurance when our Fiesta was written off... Kind of twee to name a car but the first two letters of the number plate are KT, so we couldn't help it. Anyway I've had the insurance settlement now, got a cheque in the post on Saturday, so I have to hand back the hire car. We have four working days but I've arranged for them to collect on Thursday as I'll be at home then. Bye then Katie!

Also got a cheque for the leftover road tax on the Fiesta which was a bonus really. Nice that it was more than the total for the year on the new car. Amazing to realise that the tax per year on our Peugeot 207 is less than the tax PER MONTH on Mum and Dad's Freelander.
:: Comment / reply

New bar in Folkestone - Kensie's

Apr124/12
Bar 24
Did I get that name right? It's in the big place on Rendezvous street, where nothing lasts too long.

The chap who claimed to be in Eastenders didn't stick around then I guess.
:: Comment / reply

Had a day out in Broadstairs

Apr124/12
Planned to go swimming and have lunch in Tenterden, but found out the big flume was closed. So, switched plans and went to Broadstairs instead.

Broadstairs is a lovely place, man alive are there a lot of pubs there! There are more than when we last went, some really great looking ones too, new micropubs. Shame the weather was so bad that I couldn't leave Clare and the boys playing on the beach and go in any of them. We will have to return, with babysitters in tow and really check them out. We played in the arcades for a bit, and had a splendid lunch in Prezzo. It's a nice one, lots of space and a great view out over the beach. I really like Broadstairs.

We also went in the Hornby Museum at the Hornby factory. Nice place for a visit, Harry and Tommy enjoyed playing with the train sets and scalextric set up there. Nice cafe too with lots of toys and a foosball / table football table.
:: Comment / reply

Paul Clarke's - I work and live in Seabrook near Folkestone, Kent. wed to Clare and father to Harry and Tommy, I am a web dev, and I do javascript, Node, php, and ruby. I like Folkestone Gerald, pubs, restaurants, home automation and other diy jiggery-pokery, history, genealogy, TV, popbitch, squirrels, pirates ☠, and time travel...