summaryrefslogtreecommitdiff
blob: 56c58a5a861b38f58be9b96d597edb1a29802600 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/sh
#
# /opt/bin/realone -- Wrapper for RealOne player

PLAY_URI=${1}
FAKE_URI=""
RP="/opt/RealPlayer9"
RN="realnetworks"

# Workaround for filename-with-spaces bug 
if [ "${PLAY_URI}" ]; then
	for i in `basename "${PLAY_URI}"`
	do
		FAKE_URI=${FAKE_URI}${i}
	done
	if ! [[ ${FAKE_URI} == `basename "${PLAY_URI}"` ]]; then
		if [[ `dirname "${PLAY_URI}"` == . ]]; then
			ln -s "${PWD}/`basename "${PLAY_URI}"`" \
				/tmp/${USER}.${FAKE_URI}
		else 
			ln -s "${PLAY_URI}" /tmp/${USER}.${FAKE_URI} 
		fi
		chmod 600 /tmp/${USER}.${FAKE_URI}
		PLAY_URI="/tmp/${USER}.${FAKE_URI}"
	fi
fi

# If needed create dir, copy files
if ! [ -d ${HOME}/.${RN} ]; then
	mkdir ${HOME}/.${RN}
fi
for i in `ls ${RP}/${RN}`
do
	if ! [ -r ${HOME}/.${RN}/${i} ]; then
		cp ${RP}/${RN}/${i} ${HOME}/.${RN}/
	fi
done

# Run
${RP}/realplay ${PLAY_URI}

# Cleanup
if [ -f /tmp/${USER}.${FAKE_URI} ]; then
	rm /tmp/${USER}.${FAKE_URI}
fi