Monday, June 17, 2013
Windows locks folders with thumbs db
Every tried to delete a network folder only to find moronic windows has placed a file there and locked it so preventing you from deleting it? The solution is simple but it always takes me longer to look it up than to do it, so here it is:
a. Open "Local group policy editor" by clicking on Run and type ‘gpedit.msc’ in the
b. Go to "User configuration" -> "Administrative Templates" -> "Windows Components" -> "Windows Explorer".
c. Turns off the caching of thumbnails in hidden thumbs.db files.
Sorted.
Tuesday, June 11, 2013
Sunday, April 7, 2013
BASH iterating over files with spaces in the name.
Recently I moved my CD collection to my server and converted everything to flac format. It's not a lossy algorithm like mp3 and it's contains meta data tags so my media server (Serviio) understands the files and shows the correct album, artist etc.
All is well and good except the bug ridden WDTV Live box won't play a flac file unless it's in a playlist and the hi-fi in the car only accepts mp3.
So for the sake of convenience I decided to create a mp3 shadow directory of the flac files. I want this to be self maintaining in so far as any new flac files added are converted. I'm not worried if I delete the flac file and leave the mp3.
This turned out to be slightly more troublesome than I originally thought. Mainly because some of the earlier flac conversions have spaces in the filenames and the script didn't handle them too well. So anyway, after a bit of playing about and searching I came to this solution:
#! /bin/bash
LOCKFILE=/tmp/flacscanrunning
SECOND=/tmp/secondrequest
mungefilename ()
{
echo "$@" | sed 's|:|-|g' | tr ' ' '_' | sed 's|_\+|_|g' | tr / - | tr -d \'\"\?\[:cntrl:\]
}
mkdir -p /shares/media/Music/mp3_shadow
chmod -R 774 /shares/media/Music/mp3_shadow
if [ -f "$LOCKFILE" ]; then
echo "Already in progress"
if [ -f "$SECOND" ]; then
# we are not first or second instance so exit
exit 0
else
touch $SECOND
# we've tagged the file. need to wait for the first instance to exit
while [ -f "$LOCKFILE" ]; do
sleep 60
done
# we can leave the lockfile as we're gonna run now.
rm $SECOND
fi
else
touch $LOCKFILE
fi
IFS="$(printf '\n\t')"
for file in $(find "$1" -name '*.flac'); do
if [ -e "$file" ] ; then
echo "found: [$file]"
PTH=${file%/*}
FLE=${file##*/}
TGT=`echo $PTH | sed s/flac/mp3_shadow/`
CFLE=$(mungefilename $FLE)
NFILE="$TGT/${CFLE%.*}.mp3"
echo "To new MP3: [$NFILE]"
mkdir -p $TGT
if [ -f "$NFILE" ]; then
echo "Already exists"
continue
fi
ffmpeg -i "$file" -ab 320k -map_metadata 0 "$NFILE";
fi
done
chmod -R 774 /shares/media/Music/mp3_shadow
rm $LOCKFILE
Monday, April 1, 2013
Relaunch...
I'm gonna try again.
A relaunch if you like. Less waffle and more substance with a more technical theme. Not that anyone reads this lol
Wednesday, April 29, 2009
Why not catch the bus? Public transport in Bristol
Public transport seems to be back in the lime light in Bristol again. There is talk of introducing an 'Oyster' style pre-payment card to try and speed things up. On top of this there has been an enormous amount of money spend by Bristol City Council to introduce 'Showcase' routes.
What this says to me is that public transport in Bristol is such a joke that the only way it can even begin to get close to being just poor instead of abysmal is to have millions spent building new bus lanes and new bus stops.
There are many reasons for this dire state of affairs; bad transport policy from the local council, high car ownership which leads to congestion and no effective competition to First Group's near monopoly.
As a result we have been left with a public transport systems that is disjointed, unreliable, sub-standard and grossly over priced.
I live in the south of Bristol and work in the north. I start work at 07:00 and finish about 16:00. Currently I commute the 8.5 miles each way by motorcycle. It takes me about 25 minutes regardless of traffic.
So lets compare this to the public transport option.
By public transport this trip would require one bus and one train journey (best option based on the Transport Direct travel website) and would take about 1 hour.
If I got prepaid monthly tickets this would cost:
First Bus zone 2 only month travel card: £52.80
Train pass one month (BTM to Filton Abbey Wood): £61.00
Total cost per month comes to £113.80
What does the bike cost to run per month?
Road Tax (£50 year*): £4.16
Insurance(£120 year**): £10.00
Tyres(£200 set***): £17.00
Maintenance **** : £5.00
Fuel ***** : £26.40
My total cost (assuming I ONLY use the bike to go to work) = £62.56/month
Why not take the bus? It costs 80% more, it takes over twice as long.
It's a no brainer really. Then when you take into account the reliability (or lack of) and punctuality (again or lack of) of the buses in Bristol it's a double no brainer. I'd be a fool to try and use public transport. Not to mention I'd probably always be at least half an hour late every day.
What I think we need is an independent panel to oversee the transport in Bristol. They should have the power to define routes and timetables, impose limits on fares and ensure that there is decent competition and real value for the people of Bristol.
Just been thinking about a comment on another blog regarding travel off-peak. A few times I've tried to catch the bus into Bristol Centre for an evening out. Of the 3 times in the last year the bus has been over 20 mins late on two occasions. On top of that it's hideously expensive (about £2.40 IIRC) and the last bus back is at 11pm which means leaving the pub about 10.30 just in case it's early. The only other option is to get a taxi which works out at £9 (£3 a mile!).
* actually was £48 in 2008
** 2008 3rd party F&T was £84.00
*** got to give bus a chance so say I wear them out each year (which I don't)
**** oil & filter etc each year, I do all the work.
***** I average 60mpg to and from work. The journey is 8.5 miles each way. 21 working days a month (assume I never take a holiday) gives 357 miles/month, which needs 6 gallons. Fuel at £4.40/gallon.
What this says to me is that public transport in Bristol is such a joke that the only way it can even begin to get close to being just poor instead of abysmal is to have millions spent building new bus lanes and new bus stops.
There are many reasons for this dire state of affairs; bad transport policy from the local council, high car ownership which leads to congestion and no effective competition to First Group's near monopoly.
As a result we have been left with a public transport systems that is disjointed, unreliable, sub-standard and grossly over priced.
I live in the south of Bristol and work in the north. I start work at 07:00 and finish about 16:00. Currently I commute the 8.5 miles each way by motorcycle. It takes me about 25 minutes regardless of traffic.
So lets compare this to the public transport option.
By public transport this trip would require one bus and one train journey (best option based on the Transport Direct travel website) and would take about 1 hour.
If I got prepaid monthly tickets this would cost:
First Bus zone 2 only month travel card: £52.80
Train pass one month (BTM to Filton Abbey Wood): £61.00
Total cost per month comes to £113.80
What does the bike cost to run per month?
Road Tax (£50 year*): £4.16
Insurance(£120 year**): £10.00
Tyres(£200 set***): £17.00
Maintenance **** : £5.00
Fuel ***** : £26.40
My total cost (assuming I ONLY use the bike to go to work) = £62.56/month
Why not take the bus? It costs 80% more, it takes over twice as long.
It's a no brainer really. Then when you take into account the reliability (or lack of) and punctuality (again or lack of) of the buses in Bristol it's a double no brainer. I'd be a fool to try and use public transport. Not to mention I'd probably always be at least half an hour late every day.
What I think we need is an independent panel to oversee the transport in Bristol. They should have the power to define routes and timetables, impose limits on fares and ensure that there is decent competition and real value for the people of Bristol.
Just been thinking about a comment on another blog regarding travel off-peak. A few times I've tried to catch the bus into Bristol Centre for an evening out. Of the 3 times in the last year the bus has been over 20 mins late on two occasions. On top of that it's hideously expensive (about £2.40 IIRC) and the last bus back is at 11pm which means leaving the pub about 10.30 just in case it's early. The only other option is to get a taxi which works out at £9 (£3 a mile!).
* actually was £48 in 2008
** 2008 3rd party F&T was £84.00
*** got to give bus a chance so say I wear them out each year (which I don't)
**** oil & filter etc each year, I do all the work.
***** I average 60mpg to and from work. The journey is 8.5 miles each way. 21 working days a month (assume I never take a holiday) gives 357 miles/month, which needs 6 gallons. Fuel at £4.40/gallon.
Subscribe to:
Comments (Atom)