-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
262 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
irssinp: AppleScript that returns a string with the current iTunes playing song. Meant to be used with "Get result of AppleScript" (cmd-shift-8) | ||
flac2mp3: extract flac metadata, encode to -V 2 mp3, set id3 tags with id3v2 | ||
latest_additions.php: RSS feed of changes to a bugzilla query. as-is it shows changes in the firefox 4 blocker list. you can pretty easily change this to any bugzilla or query. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright 2008 Octavio Ruiz | ||
# Distributed under the terms of the GNU General Public License v3 | ||
# $Header: $ | ||
# | ||
# Yet Another FLAC to MP3 script | ||
# | ||
# Author: | ||
# Octavio Ruiz (Ta^3) <tacvbo@tacvbo.net> | ||
# Contributors: | ||
# Zythme <zythmer@gmail.com> | ||
# Thanks: | ||
# Those comments at: | ||
# http://www.linuxtutorialblog.com/post/solution-converting-flac-to-mp3 | ||
# Thatch's fork and fixes at: | ||
# http://github.com/ | ||
# WebPage: | ||
# https://github.com/tacvbo/yaflac2mp3/tree | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY. YOU USE AT YOUR OWN RISK. THE AUTHOR | ||
# WILL NOT BE LIABLE FOR DATA LOSS, DAMAGES, LOSS OF PROFITS OR ANY | ||
# OTHER KIND OF LOSS WHILE USING OR MISUSING THIS SOFTWARE. | ||
# See the GNU General Public License for more details. | ||
|
||
LAME_OPTS="-V 2 --verbose" | ||
LAME=$(which lame) | ||
FLAC=$(which flac) | ||
SOURCE="." | ||
DEST="./mp3/" | ||
ID3=$(which id3v2) | ||
|
||
usage() | ||
{ | ||
EXIT=${1:-1} | ||
|
||
cat<<EOF | ||
Usage: $0 [-l <lame>] [-f <flac>] [-x <lame_opts>] | ||
[-s <source>] [-d <dest>] [-o] [-i] | ||
Usage: $0 -h | ||
Default options: | ||
<lame_opts> = ${LAME_OPTS} | ||
<lame> = ${LAME} | ||
<flac> = ${FLAC} | ||
<source> = ${SOURCE} | ||
<dest> = ${DEST} | ||
<id3_tool> = ${ID3} | ||
If you use -o, an existing mp3 file at destination dir it's overwritten | ||
If you use -i, id3_tool is set to id3v2. | ||
This is only necessary if your LAME version doesn't tag properly | ||
EOF | ||
|
||
exit ${EXIT} | ||
} | ||
|
||
while getopts l:f:x:d:s:hio name; do | ||
|
||
case "${name}" in | ||
l) | ||
LAME="${OPTARG}" | ||
;; | ||
f) | ||
FLAC="${OPTARG}" | ||
;; | ||
x) | ||
LAME_OPTS="${OPTARG}" | ||
;; | ||
s) | ||
SOURCE="${OPTARG}" | ||
;; | ||
d) | ||
DEST="${OPTARG}" | ||
;; | ||
o) | ||
OVRWRT=yes | ||
;; | ||
i) | ||
ID3="$(which id3v2 || echo '')" | ||
if [[ ! -x "$ID3" ]]; then | ||
echo -e "Requested id3v2 but not found. Only using lame.\n\n" | ||
fi | ||
;; | ||
h) | ||
usage 0 | ||
;; | ||
?) | ||
usage 1 | ||
;; | ||
esac | ||
done | ||
|
||
if [[ ! -d "${DEST}" ]]; then | ||
mkdir -p "${DEST}" | ||
[[ "$?" != "0" ]] && exit 2 | ||
fi | ||
[[ ! -d "${SOURCE}" ]] && echo "\"${SOURCE}\" is not a directory" && usage 1 | ||
|
||
old_IFS=${IFS} | ||
IFS=' | ||
' | ||
files=( `find "${SOURCE}" \( -type f -o -type l \) -a -iname '*.flac'` ) | ||
|
||
for N_files in ${!files[@]} | ||
do | ||
dst_file="${DEST}/${files[${N_files}]/%\.flac/.mp3}" | ||
[[ -e "$dst_file" ]] && [[ -z $OVRWRT ]] && continue | ||
vars=( `metaflac --no-utf8-convert --export-tags-to=- "${files[${N_files}]}"` ) | ||
|
||
for N_vars in ${!vars[@]} | ||
do | ||
# Grr | ||
# varname="$(echo "${vars[${N_vars}]%=*}" | tr [:upper:] [:lower:])" | ||
# varstring="${vars[${N_vars}]#*=}" | ||
# export "${varname// /_}=${varstring// /_}" | ||
export "$(echo "${vars[${N_vars}]%=*}" | tr [:upper:] [:lower:])=${vars[${N_vars}]#*=}" | ||
done | ||
|
||
"${FLAC}" -dc "${files[${N_files}]}" |\ | ||
"${LAME}" --ignore-tag-errors --add-id3v2 "${LAME_OPTS}" \ | ||
${artist:+--ta} ${artist} \ | ||
${tracknumber:+--tn} ${tracknumber} \ | ||
${title:+--tt} ${title} \ | ||
${album:+--tl} ${album} \ | ||
${date:+--ty} ${date} \ | ||
${genre:+--tg} ${genre} \ | ||
${comment:+--tc} ${comment} \ | ||
- "${dst_file}" | ||
|
||
# User should only run this if they know their version of lame doesn't tag | ||
# properly. Does this happen in practice? LAME 3.98 supports id3 v1 and v2 | ||
[[ -x ${ID3} ]] && ${ID3} \ | ||
${artist:+--artist} ${artist} \ | ||
${tracknumber:+--track} ${tracknumber} \ | ||
${title:+--song} ${title} \ | ||
${album:+--album} ${album} \ | ||
${date:+--year} ${date} \ | ||
${genre:+--genre} ${genre} \ | ||
${comment:+--comment} ${comment} \ | ||
"${dst_file}" | ||
|
||
done | ||
IFS=${old_IFS} | ||
|
||
exit 0 |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
<?php | ||
|
||
if ($_GET['id'] == NULL) | ||
{ | ||
print "You really meant to do something like latest_additions.php?id=SOMETHING_RANDOM_ANYTHING_WILL_DO_REALLY"; | ||
return; | ||
} | ||
|
||
$current_time = time(); | ||
$filename = "rss_" . basename($_GET['id']); | ||
|
||
if (file_exists($filename)) | ||
{ | ||
$state_file = file_get_contents($filename); | ||
$state = unserialize($state_file); | ||
if ($state['time']+12*60*60 < $current_time) | ||
{ | ||
$new_bugs = get_list(); | ||
$bug_difference = bug_diff($state['list'], $new_bugs); | ||
|
||
if (count($bug_difference != 0)) | ||
{ | ||
print_rss($bug_difference); | ||
} | ||
else //no new bugs | ||
{ | ||
print_rss($state['diff']); | ||
} | ||
|
||
$state['time'] = $current_time; | ||
$state['list'] = $new_bugs; | ||
$state['diff'] = $bug_difference; | ||
save_state($state); | ||
} | ||
else | ||
{ | ||
print_rss($state['diff']); | ||
} | ||
} | ||
else //new user! come back in 12 hours hokay | ||
{ | ||
$state = array(); | ||
$state['time'] = $current_time; | ||
$state['list'] = get_list(); | ||
$state['diff'] = array(); | ||
save_state($state); | ||
} | ||
|
||
function print_rss($items) | ||
{ | ||
print '<?xml version="1.0" encoding="utf-8"?>'; | ||
print '<rss version="2.0">'; | ||
print '<channel>'; | ||
print '<title>Firefox 4 blocker updates</title>'; | ||
print '<link>http://gilslotd.com</link>'; | ||
print '<description>The latest additions and deletions from the Firefox 4 blockers.</description>'; | ||
foreach ($items as $bug => $summary) | ||
{ | ||
print '<item>'; | ||
print '<title> Bug ' . $bug . ': ' . $summary . '</title>'; | ||
print '<link>http://bugzilla.mozilla.org/' . $bug . '</link>'; | ||
print '<description>' . $summary . '</description>'; | ||
print '<guid>' . $bug . $description . '</guid>'; | ||
print '</item>'; | ||
} | ||
print '</channel></rss>'; | ||
} | ||
|
||
function bug_diff($old, $new) | ||
{ | ||
$deletions = array_diff_key($old, $new); | ||
$additions = array_diff_key($new, $old); | ||
|
||
$result = array(); | ||
foreach ($deletions as $bug => $summary) | ||
{ | ||
$result[$bug] = "No longer blocking: " . $summary; | ||
} | ||
foreach ($additions as $bug => $summary) | ||
{ | ||
$result[$bug] = "Newly blocking: " . $summary; | ||
} | ||
return $result; | ||
} | ||
|
||
function get_list() | ||
{ | ||
$query_url = "https://api-dev.bugzilla.mozilla.org/latest/bug?cf_blocking_20=final&status=REOPENED&status=NEW&status=ASSIGNED&status=UNCONFIRMED&cf_blocking_20=beta&cf_blocking_20_type=contains_any&include_fields=id,summary"; | ||
$curl_obj = curl_init(); | ||
curl_setopt($curl_obj, CURLOPT_URL, $query_url); | ||
curl_setopt($curl_obj, CURLOPT_RETURNTRANSFER, TRUE); | ||
|
||
$buglist_json = curl_exec($curl_obj); | ||
$json_list = json_decode($buglist_json); | ||
$array_list = array(); | ||
|
||
foreach ($json_list->bugs as $bug) | ||
{ | ||
$array_list[$bug->id] = $bug->summary; | ||
} | ||
return $array_list; | ||
} | ||
|
||
function save_state($state) | ||
{ | ||
global $filename; | ||
file_put_contents($filename, serialize($state)); | ||
} | ||
?> |