2009年6月8日 星期一
在gnome右鍵加上“加曲目到foobar2000”功能
I made a little script to add files/folders in foobar from the Nautilus context menu. You should install the Nautilus-actions extension to add customized entries to the context menu.
I'm sure it's not perfect but it works on my linux (ubuntu) perhaps on yours too
Save this script in where you want with the name: foobar2000.sh. and make it executable.
After, create a context menu item using the Nautilus Actions Configuration tool. Click on Add in the Nautilus Action configuration window, and in the Add a New Action dialog box, fill in the field like this:
Label: Send to foobar2000 (or what you want)
Tooltip: Send to foobar2000 (or what you want)
Path: /your/directory/foobar2000.sh
Parameters: %M
Next, click on the Conditions tab.:
Filenames: *
Mimetypes: */*
Check "both"
and check "appears if selection has multiple files or folders"
After, click on the Advanced conditions:
Check "smb (windwos file)"
Finally, click OK and close the Nautilus Actions Configuration tool. Now, when you right-click on a file or folder, you'll see the "Send to foobar2000, and clicking on it will add file and/or folder to foobar2000.
I'm sure it's not perfect but it works on my linux (ubuntu) perhaps on yours too
CODE
#!/bin/bash
#foobar2000.sh
# your installation directory
cd ~/.foobar2000/
if [ "$1" != "" ]; then
i="$@"
else
echo "No files"
exit 0
fi
#files
#add extensions if you want
for ext in .aac .mp3 .mp4 .ogg .flac .m4a .wma .mpc .wav .rar .zip; do
files=`echo $i | sed "s/$ext /$ext\" \"z:/g"`
i=$files
done
#folder
files=`echo \"z:$i | sed "s/ \//\" \"z:\//g"`
eval wine foobar2000.exe /add "$files\""
echo "Action: adding Directory or Files \"z:${files}\" to foobar2000"
exit 0
#foobar2000.sh
# your installation directory
cd ~/.foobar2000/
if [ "$1" != "" ]; then
i="$@"
else
echo "No files"
exit 0
fi
#files
#add extensions if you want
for ext in .aac .mp3 .mp4 .ogg .flac .m4a .wma .mpc .wav .rar .zip; do
files=`echo $i | sed "s/$ext /$ext\" \"z:/g"`
i=$files
done
#folder
files=`echo \"z:$i | sed "s/ \//\" \"z:\//g"`
eval wine foobar2000.exe /add "$files\""
echo "Action: adding Directory or Files \"z:${files}\" to foobar2000"
exit 0
Save this script in where you want with the name: foobar2000.sh. and make it executable.
After, create a context menu item using the Nautilus Actions Configuration tool. Click on Add in the Nautilus Action configuration window, and in the Add a New Action dialog box, fill in the field like this:
Label: Send to foobar2000 (or what you want)
Tooltip: Send to foobar2000 (or what you want)
Path: /your/directory/foobar2000.sh
Parameters: %M
Next, click on the Conditions tab.:
Filenames: *
Mimetypes: */*
Check "both"
and check "appears if selection has multiple files or folders"
After, click on the Advanced conditions:
Check "smb (windwos file)"
Finally, click OK and close the Nautilus Actions Configuration tool. Now, when you right-click on a file or folder, you'll see the "Send to foobar2000, and clicking on it will add file and/or folder to foobar2000.
Okay, this is how I do it... shouldn't need any additional scripts, it passes on as many options as you'd like. So "foobar2000 -add file1 file2 directory3 -hide" acts just like "foobar2000.exe /add file1 file2 directory3 /hide" would.
CODE
1234567
#!/bin/bash
# launches fb2k w/ options
# set path to foobar executable
FB2K="C:\Program Files\foobar2000\foobar2000.exe"
# set Internal Field Separator : character should not appear in filepaths uris or options
IFS='|'
# gives the absolute z: path usable by wine
winepath () {
case "$1" in
/*) # absolute path
file="$1"
;;
~*) # unexpanded home-relative (?)
file="$HOME${1:1}"
# HOME + ~/path, stripping ~
;;
*) # relative path
file="$(pwd)/$1"
;;
esac
file=`echo "z:$file" | sed -e '
s%/[^/]\+/\.\./%/%g # replaces /somedir/../ by /
s%\./%%g # removes ./
s%/%\\\\%g # replace / by \
'`
}
# list of arguments separated by IFS instead of space to prevent string splitting
args=""
# go through all parameters given to script and transform them for wine use if needed
until [ -z "$1" ] ; do
case "$1" in
-h|-help)
echo "Usage : `basename $0` [options] [file1 [file2 [...]]]"
echo "Available switches: -add, -play, -pause, -playpause, -prev, -next, -rand, -stop, -exit, -show, -hide, -config -command:
#!/bin/bash
# launches fb2k w/ options
# set path to foobar executable
FB2K="C:\Program Files\foobar2000\foobar2000.exe"
# set Internal Field Separator : character should not appear in filepaths uris or options
IFS='|'
# gives the absolute z: path usable by wine
winepath () {
case "$1" in
/*) # absolute path
file="$1"
;;
~*) # unexpanded home-relative (?)
file="$HOME${1:1}"
# HOME + ~/path, stripping ~
;;
*) # relative path
file="$(pwd)/$1"
;;
esac
file=`echo "z:$file" | sed -e '
s%/[^/]\+/\.\./%/%g # replaces /somedir/../ by /
s%\./%%g # removes ./
s%/%\\\\%g # replace / by \
'`
}
# list of arguments separated by IFS instead of space to prevent string splitting
args=""
# go through all parameters given to script and transform them for wine use if needed
until [ -z "$1" ] ; do
case "$1" in
-h|-help)
echo "Usage : `basename $0` [options] [file1 [file2 [...]]]"
echo "Available switches: -add, -play, -pause, -playpause, -prev, -next, -rand, -stop, -exit, -show, -hide, -config -command:
Inspired by plukin's script.
You can add as many custom options as you want, see comment inside second "case" block.
Edit : minor readability change.
kinda funny how all this fuss about changing a unix path into a wine path is totally useless since there is a "winepath" utility. Didin't notice myself before today.
A complete & simpler version of the script to launch foobar with command line arguments would be :
A complete & simpler version of the script to launch foobar with command line arguments would be :
CODE
#!/bin/bash
# launches fb2k w/ options
# set path to foobar executable
FB2K="C:\Program Files\foobar2000\foobar2000.exe"
# set Internal Field Separator : character should not appear in filepaths uris or options
IFS='|'
# list of arguments separated by IFS instead of space to prevent string splitting
args=""
# go through all parameters given to script and transform them for wine use if needed
until [ -z "$1" ] ; do
case "$1" in
-h|-help)
echo "Usage : `basename $0` [options] [file1 [file2 [...]]]"
echo "Available switches: -add, -play, -pause, -playpause, -prev, -next, -rand, -stop, -exit, -show, -hide, -config -command:
This post has been edited by Houlecorn: Feb 14 2009, 01:05# launches fb2k w/ options
# set path to foobar executable
FB2K="C:\Program Files\foobar2000\foobar2000.exe"
# set Internal Field Separator : character should not appear in filepaths uris or options
IFS='|'
# list of arguments separated by IFS instead of space to prevent string splitting
args=""
# go through all parameters given to script and transform them for wine use if needed
until [ -z "$1" ] ; do
case "$1" in
-h|-help)
echo "Usage : `basename $0` [options] [file1 [file2 [...]]]"
echo "Available switches: -add, -play, -pause, -playpause, -prev, -next, -rand, -stop, -exit, -show, -hide, -config -command:
2009年6月6日 星期六
wine + foobar2000 安裝後調整筆記
mv ~/.wine/drive_c/Program\ Files/foobar2000 ~/.foobar2000
改用建link的方式玩
ln -s ~/.wine/drive_c/Program\ Files/foobar2000 ~/.foobar2000
sudo gedit /usr/bin/foobar2000
CODE
#!/bin/sh
cd ~/.foobar2000/
if [ "$1" != "" ]; then
filename=`echo z:$1 | sed 's/\\//\\\\/g'`
env LANG="zh_TW.UTF-8" WINEPREFIX="/home/你的登入名稱/.wine" wine foobar2000.exe "$filename" &
else
env LANG="zh_TW.UTF-8" WINEPREFIX="/home/你的登入名稱/.wine" wine foobar2000.exe &
fi
單用
LANG="zh_TW.UTF-8"
似乎就可以
加一個icon連結到聲音及多媒體的選單底下
gksudo gedit /usr/share/applications/foobar2000.desktop
[Desktop Entry]
Type=Application
Name=foobar2000
GenericName=Plays Music
Version=1.0
Encoding=UTF-8
Terminal=false
Exec=/usr/bin/foobar2000
Comment=Plays Music
Icon=foobar2000.png
Categories=GNOME;GTK;AudioVideo;Audio;Player;
Type=Application
Name=foobar2000
GenericName=Plays Music
Version=1.0
Encoding=UTF-8
Terminal=false
Exec=/usr/bin/foobar2000
Comment=Plays Music
Icon=foobar2000.png
Categories=GNOME;GTK;AudioVideo;Audio;Player;
在gnome右鍵選單加上“add files to foobar2000 ”
Foobar安裝後慣用變更筆記
在第一次安裝後,第一次啟動的 “Quick Appearance Setup”中
再選 “View” -> “Layout” -> “Enable Layout Editing Mode”
用滑鼠右鍵點選左邊的 “Cover Art + Tabs” 區塊,複製(Copy UI Element)
再選 “View” -> “Layout” -> “Quick Setup”
改用慣用的 “Album List + Properties”
按右鍵選“paste UI Element”,把左邊的區塊蓋上去貼掉
先選最底下的“Visualisation + Cover Art + Tabs”
再選 “View” -> “Layout” -> “Enable Layout Editing Mode”
用滑鼠右鍵點選左邊的 “Cover Art + Tabs” 區塊,複製(Copy UI Element)
再選 “View” -> “Layout” -> “Quick Setup”
改用慣用的 “Album List + Properties”
按右鍵選“paste UI Element”,把左邊的區塊蓋上去貼掉
訂閱:
文章 (Atom)