My favorites
▼
|
Sign in
torrentexpander
This script is designed to be a perfect companion to the Transmission torrent client and Flexget
Project Home
Downloads
Wiki
Issues
Source
READ-ONLY: This project has been
archived
. For more information see
this post
.
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
20
attachment: imdb_tmdb_debug.sh
(6.7 KB)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# IMDB & TMDB plugin
# Debug info
debug_mode="yes"
debug_log="/home/Sheldon/txdebug.tmp"
if [[ "$folder_short" && "$tv_shows_fix_numbering" == "yes" && "$gnu_sed_available" != "yes" ]] || [[ "$folder_short" && "$clean_up_filenames" == "yes" && "$gnu_sed_available" != "yes" ]] || [[ "$folder_short" && "$imdb_funct_on" == "yes" && "$gnu_sed_available" != "yes" ]]; then folder_short=`echo "$(cat "$log_file" | sed -n '$p' | sed 's;.*/;;g')"`; sed -i '' '$d' "$log_file"
elif [[ "$folder_short" && "$tv_shows_fix_numbering" == "yes" && "$gnu_sed_available" == "yes" ]] || [[ "$folder_short" && "$clean_up_filenames" == "yes" && "$gnu_sed_available" == "yes" ]] || [[ "$folder_short" && "$imdb_funct_on" == "yes" && "$gnu_sed_available" != "yes" ]]; then folder_short=`echo "$(cat "$log_file" | sed -n '$p' | sed 's;.*/;;g')"`; sed -i '$d' "$log_file"
fi
if [[ "$debug_mode" == "yes" ]]; then
if [ ! -f "$debug_log" ]; then
touch "$debug_log"
fi
echo "--> LOG START <--" >> "$debug_log";
echo "IMDB Title: $imdb_title" >> "$debug_log";
fi
if [ "$imdb_title" ] && [[ "$imdb_poster" == "yes" || "$imdb_nfo" == "yes" || "$imdb_fanart" == "yes" ]]; then
if [ "$has_display" == "yes" ]; then step_number=$(( $step_number + 1 )) && echo "Step $step_number : Generating NFO and downloading Images"; fi
if [ "$imdb_poster_format" == "normal" ]; then poster_size="POSTER"
elif [ "$imdb_poster_format" == "small" ]; then poster_size="POSTER_SMALL"
elif [ "$imdb_poster_format" == "large" ]; then poster_size="POSTER_LARGE"
elif [ "$imdb_poster_format" == "full" ]; then poster_size="POSTER_FULL"
fi
if [[ "$debug_mode" == "yes" ]]; then echo "IMDB Poster format: $imdb_poster_format" >> "$debug_log"; fi
if [[ "$wget_curl" == *wget* ]]; then
"$wget_curl" -q -O "$temp_folder/imdb.xml" "http://labaia.hellospace.net/imdbWebService.php?m=$imdb_title&o=xml" && wait;
if [[ -f "$temp_folder/imdb.xml" ]]; then
if [[ "$debug_mode" == "yes" ]]; then echo "IMDB Scraper file downloaded" >> "$debug_log"; fi
imdb_url=`echo "$(cat "$temp_folder/imdb.xml" | grep "<IMDB_URL>" | sed 's/^[ \t]*//' | sed 's/[ \t]*$//' | sed 's/<[^>]*>//g')"`;
imdb_id=`echo "$(cat "$temp_folder/imdb.xml" | grep "<TITLE_ID>" | sed 's/^[ \t]*//' | sed 's/[ \t]*$//' | sed 's/<[^>]*>//g')"`;
if [[ "$debug_mode" == "yes" ]]; then echo "IMDB url: $imdb_url" >> "$debug_log"; echo "IMDB id: $imdb_id" >> "$debug_log"; fi
if [[ "$imdb_poster" == "yes" ]]; then
poster_url=`echo "$(cat "$temp_folder/imdb.xml" | grep "<$poster_size>" | sed 's/^[ \t]*//' | sed 's/[ \t]*$//' | sed 's/<[^>]*>//g')"`;
if [[ "$poster_url" != "" ]]; then
if [[ "$debug_mode" == "yes" ]]; then echo "Poster url: $poster_url" >> "$debug_log"; fi
"$wget_curl" -q "$poster_url" -O "$temp_folder_without_slash/temp_poster" && wait;
if [[ "$debug_mode" == "yes" && -f "$temp_folder_without_slash/temp_poster" ]]; then echo "Poster downloaded" >> "$debug_log"; fi
fi
fi
if [[ "$imdb_fanart" == "yes" ]]; then
"$wget_curl" -q -O "$temp_folder/themoviedb.xml" "http://api.themoviedb.org/2.1/Movie.imdbLookup/en/xml/57983e31fb435df4df77afb854740ea9/$imdb_id" && wait;
if [[ -f "$temp_folder/themoviedb.xml" ]]; then
if [[ "$debug_mode" == "yes" ]]; then echo "TMDB Scraper file downloaded" >> "$debug_log"; fi
fanart_url=`echo "$(cat "$temp_folder/themoviedb.xml" | grep "backdrop" | grep "$imdb_fanart_format" | head -n 1 | cut -d'"' -f4)"`;
if [[ "$fanart_url" != "" ]]; then
if [[ "$debug_mode" == "yes" ]]; then echo "TMDB fanart url: $fanart_url" >> "$debug_log"; fi
"$wget_curl" -q -O "$temp_folder_without_slash/temp_fanart" "$fanart_url" && wait;
if [[ "$debug_mode" == "yes" && -f "$temp_folder_without_slash/temp_fanart" ]]; then echo "Fanart downloaded" >> "$debug_log"; fi
fi
fi
fi
fi
elif [[ "$wget_curl" == *curl* ]]; then
xml_cont=`echo "$("$wget_curl" -silent -i "http://labaia.hellospace.net/imdbWebService.php?m=$imdb_title&o=xml"; wait)"`;
if [ -f "$temp_folder/imdb.xml" ]; then
imdb_url=`echo "$(echo "$xml_cont" | grep "<IMDB_URL>" | sed 's/^[ \t]*//' | sed 's/[ \t]*$//' | sed 's/<[^>]*>//g')"`;
imdb_id=`echo "$(echo "$xml_cont" | grep "<TITLE_ID>" | sed 's/^[ \t]*//' | sed 's/[ \t]*$//' | sed 's/<[^>]*>//g')"`;
poster_url=`echo "$(echo "$xml_cont" | grep "<$poster_size>" | sed 's/^[ \t]*//' | sed 's/[ \t]*$//' | sed 's/<[^>]*>//g')"`;
# if [ "$imdb_fanart" == "yes" ]; then
# themoviedb_xml_cont=`echo "$("$wget_curl" -silent -i "http://api.themoviedb.org/2.1/Movie.imdbLookup/en/xml/57983e31fb435df4df77afb854740ea9/$imdb_id"; wait)"`;
# fanart_url=`echo "$(cat "$themoviedb_xml_cont" | grep "backdrop" | grep "$imdb_fanart_format" | head -n 1 | cut -d'"' -f4)"`;
# "$wget_curl" -silent -o "$temp_folder_without_slash/temp_fanart" "$fanart_url"; wait;
# fi
if [ "$imdb_poster" == "yes" ]; then curl -silent -o "$temp_folder_without_slash/temp_poster" "$poster_url"; wait; fi
fi
fi
if [ ! "$folder_short" ] && [ -f "$temp_folder/imdb.xml" ]; then folder_short=`echo "$(basename "$(cat "$log_file")")" | sed 's/\(.*\)\..*/\1/' | sed 's;.*/;;g'` && mkdir -p "$temp_folder$folder_short/" && mv -f "$(cat "$log_file")" "$temp_folder$folder_short/"; fi
if [ -f "$temp_folder/imdb.xml" ]; then
for item in $(find "$temp_folder$folder_short" -type f | egrep -i "$movies_extensions_rev"); do
nfo_file=`echo "$item" | sed 's/\(.*\)\..*/\1.nfo/'`;
poster=`echo "$item" | sed 's/\(.*\)\..*/\1.jpg/'`;
fanart=`echo "$item" | sed 's/\(.*\)\..*/\1.fanart.jpg/'`;
if [ "$imdb_nfo" == "yes" ]; then echo "$imdb_url" > "$nfo_file"; fi
if [ -f "$temp_folder_without_slash/temp_poster" ] && [ "$imdb_poster" == "yes" ]; then cp -f "$temp_folder_without_slash/temp_poster" "$poster"; fi
if [ -f "$temp_folder_without_slash/temp_fanart" ] && [ "$imdb_fanart" == "yes" ]; then cp -f "$temp_folder_without_slash/temp_fanart" "$fanart"; fi
if [[ "$debug_mode" == "yes" ]]; then echo "nfo saved: $nfo_file" >> "$debug_log"; echo "poster saved: $poster" >> "$debug_log"; echo "fanart saved: $fanart" >> "$debug_log"; fi
done
fi
if [[ "$debug_mode" == "yes" ]]; then echo "--> LOG END <--" >> "$debug_log";
if [ -f "$temp_folder_without_slash/temp_poster" ]; then rm "$temp_folder_without_slash/temp_poster"; fi
if [ -f "$temp_folder_without_slash/temp_fanart" ]; then rm "$temp_folder_without_slash/temp_fanart"; fi
supported_extensions_rev="$supported_extensions_rev|\.nfo$|\.jpg$"
movies_extensions_rev="$movies_extensions_rev|\.nfo$|\.jpg$"
if [ ! "$folder_short" ]; then echo "$(find "$temp_folder$folder_short" -maxdepth 1 -mindepth 1 -type f | egrep -i "$supported_extensions_rev")" > "$log_file"; fi
fi
Powered by
Google Project Hosting