summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Toso <me@victortoso.com>2014-06-02 03:21:29 -0300
committerVictor Toso <me@victortoso.com>2014-06-23 02:07:25 -0300
commit1c6a033018f042750aa57c0f5387d073d7d84e4a (patch)
tree09a4efafd1686cf7afb74ad46a81d3f0f251de64
parentb2b937413a26a0fe2ad18891a27a30a35b12b26b (diff)
thetvdb: Include tests
https://bugzilla.gnome.org/show_bug.cgi?id=672933
-rw-r--r--tests/Makefile.am5
-rw-r--r--tests/thetvdb/Makefile.am70
-rw-r--r--tests/thetvdb/data/adventure_time_get_series.txt16
-rw-r--r--tests/thetvdb/data/adventure_time_series_all_en.zipbin0 -> 24373 bytes
-rw-r--r--tests/thetvdb/data/boardwalk_empire_get_series.txt15
-rw-r--r--tests/thetvdb/data/boardwalk_empire_series_all_en.zipbin0 -> 17387 bytes
-rw-r--r--tests/thetvdb/data/config.ini32
-rw-r--r--tests/thetvdb/data/felicity_get_series.txt30
-rw-r--r--tests/thetvdb/data/felicity_series_all_en.zipbin0 -> 42587 bytes
-rw-r--r--tests/thetvdb/data/house_get_series.txt297
-rw-r--r--tests/thetvdb/data/house_series_all_en.zipbin0 -> 55666 bytes
-rw-r--r--tests/thetvdb/data/naruto_get_series.txt39
-rw-r--r--tests/thetvdb/data/naruto_series_all_en.zipbin0 -> 45364 bytes
-rw-r--r--tests/thetvdb/test_thetvdb_resolve_episodes.c180
-rw-r--r--tests/thetvdb/test_thetvdb_resolve_shows.c194
-rw-r--r--tests/thetvdb/test_thetvdb_resolve_stress.c324
-rw-r--r--tests/thetvdb/test_thetvdb_utils.c65
-rw-r--r--tests/thetvdb/test_thetvdb_utils.h35
18 files changed, 1302 insertions, 0 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5ffcba1..647a531 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -29,6 +29,10 @@ if TMDB_PLUGIN
SUBDIRS += tmdb
endif
+if THETVDB_PLUGIN
+SUBDIRS += thetvdb
+endif
+
if VIMEO_PLUGIN
SUBDIRS += vimeo
endif
@@ -39,6 +43,7 @@ DIST_SUBDIRS = \
dleyna \
local-metadata \
tmdb \
+ thetvdb \
vimeo
MAINTAINERCLEANFILES = \
diff --git a/tests/thetvdb/Makefile.am b/tests/thetvdb/Makefile.am
new file mode 100644
index 0000000..b4d7b82
--- /dev/null
+++ b/tests/thetvdb/Makefile.am
@@ -0,0 +1,70 @@
+#
+# Makefile.am
+#
+# Author: Victor Toso <me@victortoso.com>
+#
+# Copyright (C) 2014 Victor Toso. All rights reserved.
+
+include $(top_srcdir)/gtester.mk
+
+INCLUDES = @DEPS_CFLAGS@
+
+TEST_PROGS += \
+ test_thetvdb_resolve_shows \
+ test_thetvdb_resolve_episodes \
+ test_thetvdb_resolve_stress
+
+test_thetvdb_defines = \
+ -DTHETVDB_PLUGIN_PATH=\""$(abs_top_builddir)/src/thetvdb/.libs/"\" \
+ -DTHETVDB_PLUGIN_TEST_DATA_PATH=\""$(abs_top_builddir)/tests/thetvdb/data/"\"
+
+test_thetvdb_resolve_shows_SOURCES = \
+ test_thetvdb_resolve_shows.c \
+ test_thetvdb_utils.h test_thetvdb_utils.c
+
+test_thetvdb_resolve_shows_LDADD = \
+ @DEPS_LIBS@
+
+test_thetvdb_resolve_shows_CFLAGS = \
+ $(test_thetvdb_defines)
+
+test_thetvdb_resolve_episodes_SOURCES = \
+ test_thetvdb_resolve_episodes.c \
+ test_thetvdb_utils.h test_thetvdb_utils.c
+
+test_thetvdb_resolve_episodes_LDADD = \
+ @DEPS_LIBS@
+
+test_thetvdb_resolve_episodes_CFLAGS = \
+ $(test_thetvdb_defines)
+
+test_thetvdb_resolve_stress_SOURCES = \
+ test_thetvdb_resolve_stress.c \
+ test_thetvdb_utils.h test_thetvdb_utils.c
+
+test_thetvdb_resolve_stress_LDADD = \
+ @DEPS_LIBS@
+
+test_thetvdb_resolve_stress_CFLAGS = \
+ $(test_thetvdb_defines)
+
+dist_noinst_DATA = \
+ data/config.ini \
+ data/adventure_time_get_series.txt \
+ data/adventure_time_series_all_en.zip \
+ data/boardwalk_empire_get_series.txt \
+ data/boardwalk_empire_series_all_en.zip \
+ data/felicity_get_series.txt \
+ data/felicity_series_all_en.zip \
+ data/house_get_series.txt \
+ data/house_series_all_en.zip \
+ data/naruto_get_series.txt \
+ data/naruto_series_all_en.zip
+
+noinst_PROGRAMS = $(TEST_PROGS)
+
+MAINTAINERCLEANFILES = \
+ *.in \
+ *~
+
+DISTCLEANFILES = $(MAINTAINERCLEANFILES)
diff --git a/tests/thetvdb/data/adventure_time_get_series.txt b/tests/thetvdb/data/adventure_time_get_series.txt
new file mode 100644
index 0000000..2ef3bca
--- /dev/null
+++ b/tests/thetvdb/data/adventure_time_get_series.txt
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Data>
+<Series>
+<seriesid>152831</seriesid>
+<language>en</language>
+<SeriesName>Adventure Time</SeriesName>
+<AliasNames>Adventure Time with Finn and Jake</AliasNames>
+<banner>graphical/152831-g2.jpg</banner>
+<Overview>Adventure Time (originally titled 'Adventure Time with Finn &amp; Jake') follows two best friends: Finn (a 12-year old boy) and Jake (a wise 28-year-old dog with magical powers), and the surreal adventures undertaken by the duo as they traverse the mystical Land of Ooo. A world built for adventure, Ooo is filled to the brim with various landscapes for the two buddies to explore and bizarre characters to assist.</Overview>
+<FirstAired>2010-04-05</FirstAired>
+<Network>Cartoon Network</Network>
+<IMDB_ID>tt1305826</IMDB_ID>
+<zap2it_id>EP01246265</zap2it_id>
+<id>152831</id>
+</Series>
+</Data>
diff --git a/tests/thetvdb/data/adventure_time_series_all_en.zip b/tests/thetvdb/data/adventure_time_series_all_en.zip
new file mode 100644
index 0000000..275f643
--- /dev/null
+++ b/tests/thetvdb/data/adventure_time_series_all_en.zip
Binary files differ
diff --git a/tests/thetvdb/data/boardwalk_empire_get_series.txt b/tests/thetvdb/data/boardwalk_empire_get_series.txt
new file mode 100644
index 0000000..64be96a
--- /dev/null
+++ b/tests/thetvdb/data/boardwalk_empire_get_series.txt
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Data>
+<Series>
+<seriesid>84947</seriesid>
+<language>en</language>
+<SeriesName>Boardwalk Empire</SeriesName>
+<banner>graphical/84947-g6.jpg</banner>
+<Overview>Boardwalk Empire is a period drama focusing on Enoch "Nucky" Thompson (based on the historical Enoch L. Johnson), a political figure who rose to prominence and controlled Atlantic City, New Jersey, during the Prohibition period of the 1920s and 1930s. Nucky interacts with several historical figures in both his personal and political life, including mobsters, politicians, government agents, and the common folk who look up to him. The federal government also takes an interest in the bootlegging and other illegal activities in the area, sending agents to investigate possible mob connections but also looking at Nucky's lifestyle?expensive and lavish for a county political figure.</Overview>
+<FirstAired>2010-09-19</FirstAired>
+<Network>HBO</Network>
+<IMDB_ID>tt0979432</IMDB_ID>
+<zap2it_id>SH01308836</zap2it_id>
+<id>84947</id>
+</Series>
+</Data>
diff --git a/tests/thetvdb/data/boardwalk_empire_series_all_en.zip b/tests/thetvdb/data/boardwalk_empire_series_all_en.zip
new file mode 100644
index 0000000..67d56af
--- /dev/null
+++ b/tests/thetvdb/data/boardwalk_empire_series_all_en.zip
Binary files differ
diff --git a/tests/thetvdb/data/config.ini b/tests/thetvdb/data/config.ini
new file mode 100644
index 0000000..da7d1eb
--- /dev/null
+++ b/tests/thetvdb/data/config.ini
@@ -0,0 +1,32 @@
+[default]
+version=1
+
+# Boardwalk Empire
+[http://thetvdb.com/api/GetSeries.php?seriesname=Boardwalk Empire]
+data = boardwalk_empire_get_series.txt
+[http://thetvdb.com/api/THETVDB_TEST_MOCK_API_KEY/series/84947/all/en.zip]
+data = boardwalk_empire_series_all_en.zip
+
+# Adventure Time
+[http://thetvdb.com/api/GetSeries.php?seriesname=Adventure Time]
+data = adventure_time_get_series.txt
+[http://thetvdb.com/api/THETVDB_TEST_MOCK_API_KEY/series/152831/all/en.zip]
+data = adventure_time_series_all_en.zip
+
+# Felicity
+[http://thetvdb.com/api/GetSeries.php?seriesname=Felicity]
+data = felicity_get_series.txt
+[http://thetvdb.com/api/THETVDB_TEST_MOCK_API_KEY/series/73980/all/en.zip]
+data = felicity_series_all_en.zip
+
+# House
+[http://thetvdb.com/api/GetSeries.php?seriesname=House]
+data = house_get_series.txt
+[http://thetvdb.com/api/THETVDB_TEST_MOCK_API_KEY/series/73255/all/en.zip]
+data = house_series_all_en.zip
+
+# Naruto
+[http://thetvdb.com/api/GetSeries.php?seriesname=Naruto]
+data = naruto_get_series.txt
+[http://thetvdb.com/api/THETVDB_TEST_MOCK_API_KEY/series/78857/all/en.zip]
+data = naruto_series_all_en.zip
diff --git a/tests/thetvdb/data/felicity_get_series.txt b/tests/thetvdb/data/felicity_get_series.txt
new file mode 100644
index 0000000..dc6e89e
--- /dev/null
+++ b/tests/thetvdb/data/felicity_get_series.txt
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Data>
+<Series>
+<seriesid>73980</seriesid>
+<language>en</language>
+<SeriesName>Felicity</SeriesName>
+<banner>graphical/253-g.jpg</banner>
+<Overview>This coming-of-age drama tracked the experiences of the naive Felicity Porter, who moves across the country to New York to attend college and pursue her high school crush, Ben Covington. The show followed Felicity and her new friends as they made the transition to adulthood and dealt with an endless slew of crises. Felicity airs back-to-back episodes on WE (Women's Entertainment) weeknights at 6 PM Eastern/3 PM Pacific. WB Broadcast History September 1998 - May 1999: Tuesdays 9:00 PM September 1999 - February 2000: Sundays 8:00 PM April 2000 - May 2002: Wednesdays 9:00 PM</Overview>
+<FirstAired>1998-09-29</FirstAired>
+<Network>The WB</Network>
+<IMDB_ID>tt0134247</IMDB_ID>
+<zap2it_id>SH184561</zap2it_id>
+<id>73980</id>
+</Series>
+<Series>
+<seriesid>259111</seriesid>
+<language>en</language>
+<SeriesName>Felicity Kendals Indian Shakespeare Quest</SeriesName>
+<banner>graphical/259111-g.jpg</banner>
+<Overview>Long before she set foot on stage in England, Felicity Kendal launched her acting career in India, where her parents ran an eccentric touring theatre company called Shakespeareana. In this film she returns to the land of her childhood to discover the full story of India's enduring love-affair with Shakespeare - from the first days of Empire to Bollywood and beyond.
+
+Shaped by her enthusiasm to discover more about a drama in which her own family played a role, Felicity's emotional journey takes her to India's iconic cities and to other places far off the beaten track. Along the way she meets film stars and prison inmates, kings and market traders, schoolchildren, historians and her own Indian relatives, in a quest to understand how and why Shakespeare's plays made the transition from being symbols of British cultural dominance to inspiring a new generation of artists and film-makers in modern India.
+
+Full of surprises, personal revelations and historical insights, this compelling film reveals an unexpected side to one of the UK's favourite performers as she uncovers the story of how England's national dramatist became an iconic figure in a land far removed from the country of his birth.</Overview>
+<FirstAired>2012-05-16</FirstAired>
+<Network>BBC Two</Network>
+<IMDB_ID>tt2218716</IMDB_ID>
+<id>259111</id>
+</Series>
+</Data>
diff --git a/tests/thetvdb/data/felicity_series_all_en.zip b/tests/thetvdb/data/felicity_series_all_en.zip
new file mode 100644
index 0000000..79b1e13
--- /dev/null
+++ b/tests/thetvdb/data/felicity_series_all_en.zip
Binary files differ
diff --git a/tests/thetvdb/data/house_get_series.txt b/tests/thetvdb/data/house_get_series.txt
new file mode 100644
index 0000000..c1e0227
--- /dev/null
+++ b/tests/thetvdb/data/house_get_series.txt
@@ -0,0 +1,297 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Data>
+<Series>
+<seriesid>73255</seriesid>
+<language>en</language>
+<SeriesName>House</SeriesName>
+<AliasNames>House M.D.</AliasNames>
+<banner>graphical/73255-g22.jpg</banner>
+<Overview>Go deeper into the medical mysteries of House, TV's most compelling drama. Hugh Laurie stars as the brilliant but sarcastic Dr. Gregory House, a maverick physician who is devoid of bedside manner. While his behavior can border on antisocial, Dr. House thrives on the challenge of solving the medical puzzles that other doctors give up on. Together with his hand-picked team of young medical experts, he'll do whatever it takes in the race against the clock to solve the case.</Overview>
+<FirstAired>2004-11-16</FirstAired>
+<Network>FOX</Network>
+<IMDB_ID>tt0412142</IMDB_ID>
+<zap2it_id>EP00688359</zap2it_id>
+<id>73255</id>
+</Series>
+<Series>
+<seriesid>70500</seriesid>
+<language>en</language>
+<SeriesName>Full House</SeriesName>
+<banner>graphical/70500-g.jpg</banner>
+<Overview>Set in San Francisco, this is a show about a very loving family headed by Danny Tanner, who became a single father when his wife, Pam Tanner, was killed in a car accident. Pam's brother Jesse, and Danny's best friend Joey Gladstone moved into the house to help Danny raise his three daughters D.J., Stephanie, and Michelle.</Overview>
+<FirstAired>1987-09-22</FirstAired>
+<Network>ABC</Network>
+<IMDB_ID>tt0092359</IMDB_ID>
+<zap2it_id>EP00001771</zap2it_id>
+<id>70500</id>
+</Series>
+<Series>
+<seriesid>262980</seriesid>
+<language>en</language>
+<SeriesName>House of Cards (US)</SeriesName>
+<AliasNames>House of Cards (2013)</AliasNames>
+<banner>graphical/262980-g4.jpg</banner>
+<Overview>House of Cards is an American political drama series developed and produced by Beau Willimon. It is an adaptation of a previous BBC miniseries of the same name which is based on the novel by Michael Dobbs.
+Set in present day Washington, D.C., House of Cards is the story of Frank Underwood (Kevin Spacey), a Democrat from South Carolina's 5th congressional district and the House Majority Whip, who, after getting passed over for promotion to Secretary of State, decides to exact his revenge on those who betrayed him. The series also stars Robin Wright, Kate Mara and Corey Stoll in lead roles.</Overview>
+<FirstAired>2013-02-01</FirstAired>
+<Network>Netflix</Network>
+<IMDB_ID>tt1856010</IMDB_ID>
+<zap2it_id>EP01676454</zap2it_id>
+<id>262980</id>
+</Series>
+<Series>
+<seriesid>253105</seriesid>
+<language>en</language>
+<SeriesName>Justin's House</SeriesName>
+<banner>graphical/253105-g.jpg</banner>
+<Overview>Roar with laughter with Justin and his friends, as they get themselves into funny situations around Justin?s House.</Overview>
+<FirstAired>2011-10-08</FirstAired>
+<Network>CBeebies</Network>
+<id>253105</id>
+</Series>
+<Series>
+<seriesid>81249</seriesid>
+<language>en</language>
+<SeriesName>Run's House</SeriesName>
+<banner>graphical/81249-g.jpg</banner>
+<Overview>Run's had his hands full with his lovely wife and family. Oh, and don't forget about his comeback album. Roll with Rev Run and fam in this reality sitcom. Who's house? Run's House!</Overview>
+<FirstAired>2005-10-13</FirstAired>
+<Network>MTV</Network>
+<IMDB_ID>tt0470659</IMDB_ID>
+<zap2it_id>SH778747</zap2it_id>
+<id>81249</id>
+</Series>
+<Series>
+<seriesid>263009</seriesid>
+<language>en</language>
+<SeriesName>Live from Daryl's House</SeriesName>
+<banner>graphical/263009-g.jpg</banner>
+<Overview>Daryl Hall started Live From Daryl's House, the free monthly web show in late 2007, after having the idea of "playing with my friends and putting it up on the Internet," and the show has since garnered acclaim from Rolling Stone, SPIN, Daily Variety, CNN, BBC, Yahoo! Music and influential blogger Bob Lefsetz, who cited Live From Daryl's House as a perfect example of a veteran artist reinventing himself in the digital age by collaborating with both established colleagues and newer performers.</Overview>
+<FirstAired>2007-11-15</FirstAired>
+<id>263009</id>
+</Series>
+<Series>
+<seriesid>252124</seriesid>
+<language>en</language>
+<SeriesName>Playboy's Beach House</SeriesName>
+<Overview>If you thought the mansion was hot, wait'll you see this!</Overview>
+<Network>Playboy TV</Network>
+<IMDB_ID>tt1811180</IMDB_ID>
+<id>252124</id>
+</Series>
+<Series>
+<seriesid>249271</seriesid>
+<language>en</language>
+<SeriesName>Hector's House</SeriesName>
+<banner>graphical/249271-g.jpg</banner>
+<Overview>Originally a French series called "La Maison de TouTou", "Hector's House" was a children's puppet series transmitted between 1968 and 1971, usually shown just before the teatime news on BBC1. Each episode is a small tale featuring Hector the dog, Zaza the cat and neighbour Kiki the frog.</Overview>
+<FirstAired>1968-06-04</FirstAired>
+<Network>BBC One</Network>
+<IMDB_ID>tt0367335</IMDB_ID>
+<id>249271</id>
+</Series>
+<Series>
+<seriesid>84091</seriesid>
+<language>en</language>
+<SeriesName>Big Daddy's House</SeriesName>
+<Overview>Watch out Big Daddy is in the house and ready to cook! The Next Food Network Star's Season 4 winner, Aaron McCargo, Jr., shares his passion for big, bold flavors and fun, family cooking on his new daytime series, Big Daddy's House. Aaron brings a down-to-earth vibe and a warm smile to the kitchen while whipping up mouth-watering recipes inspired by many years of culinary experience and his fun-loving family. Expect big food and big fun on Big Daddy's House.</Overview>
+<FirstAired>2008-08-10</FirstAired>
+<Network>Food Network</Network>
+<IMDB_ID>tt1312382</IMDB_ID>
+<zap2it_id>EP01077523</zap2it_id>
+<id>84091</id>
+</Series>
+<Series>
+<seriesid>77095</seriesid>
+<language>en</language>
+<SeriesName>House of Buggin'</SeriesName>
+<Overview>Welcome to the House of Buggin' guide at TV Tome. House of Buggin' was a short-lived variety show. There is no editor for this show. If you would like to be the editor look here for details.</Overview>
+<FirstAired>1995-01-01</FirstAired>
+<Network>FOX</Network>
+<id>77095</id>
+</Series>
+<Series>
+<seriesid>224991</seriesid>
+<language>en</language>
+<SeriesName>Jonathan Meades - The Victorian House</SeriesName>
+<banner>graphical/224991-g2.jpg</banner>
+<FirstAired>1986-01-24</FirstAired>
+<Network>Channel 4</Network>
+<id>224991</id>
+</Series>
+<Series>
+<seriesid>249171</seriesid>
+<language>en</language>
+<SeriesName>Sarah's House</SeriesName>
+<banner>graphical/249171-g.jpg</banner>
+<Overview>Sarah Richardson is an expert at house-flipping. Watch as she buys the most run-down house in the best neighborhood and reworks it into a fabulous abode room by room in this HGTV series.</Overview>
+<Network>HGTV</Network>
+<id>249171</id>
+</Series>
+<Series>
+<seriesid>253776</seriesid>
+<language>en</language>
+<SeriesName>Who's Been Sleeping in my House</SeriesName>
+<banner>graphical/253776-g2.jpg</banner>
+<Overview>Have you ever wondered about who lived in your house before you? Where did they come from? What were their dreams, hopes and fears? And what became of them? "Who's Been Sleeping In My House?" is a new 8-part Australian series presented by archaeologist Adam Ford exploring the incredible stories that lie between the bricks and mortar of our homes. From the Western Australian goldfields to the tropics of Queensland, Adam peels back the extraordinary lives of everyday Australians - people who lived, loved, bore children and moved on in the great cycle of life. As ghosts of the past, family secrets and architectural surprises are revealed, one thing is for certain - the present owners' relationships with their homes will be changed forever by the startling mysteries and unexpected revelations Adam unearths. This is an exciting new series format where the walls really do talk. Beneath the floorboards, between the walls, under the eaves, or somewhere deep down in the garden, the secrets of the past are just waiting to be revealed - because every home has a story to tell. </Overview>
+<FirstAired>2011-11-21</FirstAired>
+<Network>ABC</Network>
+<id>253776</id>
+</Series>
+<Series>
+<seriesid>252307</seriesid>
+<language>en</language>
+<SeriesName>Frankie's House</SeriesName>
+<Overview>In 1964 in Laos, young Tim Page discovers his vocation as a photo journalist and is given a job, a camera, and a trip to Vietnam. There, he learns the ropes, learns about the war first in Saigon, and then in country on patrol with troops. He and his colleagues, including the sons of Errol Flynn and John Steinbeck, capture the war in pictures, recover from their wounds, swap stories, battle censorship, and support each other between the explosions at the brothel run by Tranh Ki: Frankie's House.
+
+Produced by Anglia Television for the ITV Network.</Overview>
+<FirstAired>1992-05-09</FirstAired>
+<Network>ITV</Network>
+<IMDB_ID>tt0104294</IMDB_ID>
+<id>252307</id>
+</Series>
+<Series>
+<seriesid>248196</seriesid>
+<language>en</language>
+<SeriesName>Tommy Walsh's Eco House </SeriesName>
+<Overview>TV DIY star Tommy Walsh was set the challenge of a lifetime. In a brand new series on Discovery Real Time 'Tommy Walsh?s Eco House' sees Tommy and his team, push their talents right to the edge, going beyond anything he has previously attempted on TV - to build an eco friendly house in 60 days for ?60K!</Overview>
+<FirstAired>2008-03-23</FirstAired>
+<Network>Discovery</Network>
+<id>248196</id>
+</Series>
+<Series>
+<seriesid>249172</seriesid>
+<language>en</language>
+<SeriesName>Sarah's Summer House</SeriesName>
+<Overview>Sarah Richardson tackles the renovation of her own weekend getaway. Located 17 miles offshore and purchased by her husband as a bachelor shack, this tiny island cottage is completely off the grid with a combination of solar, wind and propane energy. It's rustic, relaxing and at one with the stunning lake scenery. Character, storage and versatility are key as Sarah untangles the renovation processes with tip after tip on how to handle an out-of-town reno ? without having an out-of-body experience</Overview>
+<FirstAired>2011-05-31</FirstAired>
+<Network>HGTV</Network>
+<id>249172</id>
+</Series>
+<Series>
+<seriesid>181551</seriesid>
+<language>en</language>
+<SeriesName>Grandma's House</SeriesName>
+<banner>graphical/181551-g2.jpg</banner>
+<Overview>TV presenter Simon Amstell plays a version of himself in Grandma's House, a new six-part comedy written by Simon and his long-term collaborator Dan Swimer.
+
+The series stars Simon Amstell as a TV presenter who is quitting his job to try to do something more meaningful with his life.
+
+Each episode is set at Grandma's house, where Simon's family regularly congregate to catch up. Everything happens under the watchful eye of Grandma, who is desperate to see everything going well.</Overview>
+<FirstAired>2010-08-09</FirstAired>
+<Network>BBC Two</Network>
+<IMDB_ID>tt1706532</IMDB_ID>
+<id>181551</id>
+</Series>
+<Series>
+<seriesid>78466</seriesid>
+<language>en</language>
+<SeriesName>The Magician's House</SeriesName>
+<banner>graphical/78466-g.jpg</banner>
+<Overview>Welcome to The Magician's House guide at TV Tome. Three courageous children and a sometimes wise, sometimes wrongheaded magician come together to stop the destruction by the magician's rebel apprentice-400 years in the past!</Overview>
+<FirstAired>1999-10-01</FirstAired>
+<Network>BBC One</Network>
+<IMDB_ID>tt0216894</IMDB_ID>
+<id>78466</id>
+</Series>
+<Series>
+<seriesid>78843</seriesid>
+<language>en</language>
+<SeriesName>MTV's The '70s House</SeriesName>
+<banner>text/38881.jpg</banner>
+<Overview>MTV takes 12 kids of the new millennium and forces them to live as if they were in the 1970's. That's right, no iPods, cell phones, or laptops! Say goodbye to modern day conveniences and say hello to 8-tracks and rotary dial phones! How groovy!</Overview>
+<FirstAired>2005-07-05</FirstAired>
+<Network>MTV</Network>
+<id>78843</id>
+</Series>
+<Series>
+<seriesid>70672</seriesid>
+<language>en</language>
+<SeriesName>Wimzie's House</SeriesName>
+<banner>graphical/70672-g.jpg</banner>
+<Overview>Wimzie's House, an educationally entertaining series for preschool kids, premiered on YTV Canada 11 September 1995. Its PBS debut occurred 1 September 1997, after the series' production ended. The series presented the delightful adventures of Wimzie, a playful five-year-old puppet monster; her baby brother, Bo; her parents, Gratziella and Rouso-a bird/airplane pilot and dragon/firefighter, respectively; her lively 150-year-old grandmother Yaya, and her adorable puppet monster friends. Together, they learned skills of caring and sharing at Wimzie's House-a home daycare center unlike any other. Through unforgetable learning adventures and original toe-tapping sing-along songs, young viewers were introduced to topics like friendship, generosity, jealousy, diversity, and sibling rivalry, all from a preschooler's point of view. The award-winning series was created with a renowned team of educational advisors and designed to nurture children's sense of identity, expand their relationships, stimulate their curiousity, and encourage self-expression and self-esteem. </Overview>
+<FirstAired>1997-10-01</FirstAired>
+<Network>A&amp;E</Network>
+<IMDB_ID>tt0242240</IMDB_ID>
+<id>70672</id>
+</Series>
+<Series>
+<seriesid>265541</seriesid>
+<language>en</language>
+<SeriesName>A Hundred Year's Inheritance</SeriesName>
+<AliasNames>A 100-Year Legacy|Noodle House</AliasNames>
+<banner>graphical/265541-g.jpg</banner>
+<Overview>Min Chae Won (Eugene) is the eldest granddaughter of a noodle family, who comes back to the family business after a divorce. She eventually turns the small mom-and-pop operation into a ?designer noodle company?. Lee Se Yoon (Lee Jung Jin) is a guy who seems cold and prickly on the outside but is actually warm and cuddly on the inside.</Overview>
+<FirstAired>2013-01-05</FirstAired>
+<Network>MBC</Network>
+<id>265541</id>
+</Series>
+<Series>
+<seriesid>82046</seriesid>
+<language>en</language>
+<SeriesName>Dollhouse</SeriesName>
+<AliasNames>Doll House</AliasNames>
+<banner>graphical/82046-g3.jpg</banner>
+<Overview>The show revolves around a corporation running numerous underground establishments across the globe which program individuals referred to as Actives with temporary personalities and skills. Wealthy clients hire Actives at great expense for various purposes. The series follows the Active known as Echo, on her journey towards self-awareness.</Overview>
+<FirstAired>2009-02-13</FirstAired>
+<Network>FOX</Network>
+<IMDB_ID>tt1135300</IMDB_ID>
+<zap2it_id>SH1059106</zap2it_id>
+<id>82046</id>
+</Series>
+<Series>
+<seriesid>259629</seriesid>
+<language>en</language>
+<SeriesName>Bob's Full House</SeriesName>
+<Overview>Bob's Full House was a popular quiz programme hosted by Bob Monkhouse which was based on the popular game 'Bingo' and aired on BBC1 from 1 September 1984 until 27 January 1990.
+
+On Bob's Full House four contestants competed to fill in their Bingo-style card. Correct answer to questions covered up a number but incorrect answers causes players to sit out the next question (this was classified as getting wallied).</Overview>
+<FirstAired>1984-09-01</FirstAired>
+<Network>BBC One</Network>
+<id>259629</id>
+</Series>
+<Series>
+<seriesid>248502</seriesid>
+<language>en</language>
+<SeriesName>Archie's Fun House</SeriesName>
+<banner>graphical/248502-g.jpg</banner>
+<Overview>Archie appears on stage in front of a theater full of (live-action) kids each week and introduces his Fun House and the star of the show, the Giant Jukebox. The Archie gang gives its audience crazy blackout gags, outrageous puns and wacky jokes. The regular segments are "How to Catch a Man" with Big Ethel, "Thunderbolt Theatre" and "Giant Jukebox Jokes." Semi-regular features include "The Early Early Show," "Betty's Diary," "The Big, Big World of Sports" with Coach Cleats, an inept trapeze act with Reggie and Moose; and more. Each episode has three songs performed by The Archies.</Overview>
+<FirstAired>1970-09-12</FirstAired>
+<Network>CBS</Network>
+<IMDB_ID>tt0065273</IMDB_ID>
+<id>248502</id>
+</Series>
+<Series>
+<seriesid>219891</seriesid>
+<language>en</language>
+<SeriesName>Dani's House</SeriesName>
+<banner>graphical/219891-g2.jpg</banner>
+<Overview>Surreal sitcom about a struggling actress, continuously left in charge of her annoying younger brother Max, his none-too-bright sidekick Ben and their youngest sibling - the baby from hell.
+
+</Overview>
+<FirstAired>2008-09-26</FirstAired>
+<Network>CBBC</Network>
+<IMDB_ID>tt1198825</IMDB_ID>
+<id>219891</id>
+</Series>
+<Series>
+<seriesid>76749</seriesid>
+<language>en</language>
+<SeriesName>Kurt Vonnegut's Monkey House</SeriesName>
+<FirstAired>1991-05-01</FirstAired>
+<Network>Showtime</Network>
+<id>76749</id>
+</Series>
+<Series>
+<seriesid>249260</seriesid>
+<language>en</language>
+<SeriesName>Spouse vs. House</SeriesName>
+<AliasNames>Spouse vs House</AliasNames>
+<banner>graphical/249260-g.jpg</banner>
+<Overview>"SPOUSE VS. HOUSE" is part design drama and part relationship renovation. In each episode, a couple is given $25,000 to make over three rooms of their house. But, before they make any design decisions, they're told that she has to move out of the house for three weeks, and he's left to handle the renovation alone - leaving her to wonder how well he knows her taste. While he's struggling to make it work, she meets with Ryan to create her dream space in a replicated room, the "doll's house." Finally, both looks are revealed and they discover if their style choices are closely married or worlds apart. (Source: TLC)
+</Overview>
+<FirstAired>2011-05-04</FirstAired>
+<Network>TLC</Network>
+<id>249260</id>
+</Series>
+</Data>
diff --git a/tests/thetvdb/data/house_series_all_en.zip b/tests/thetvdb/data/house_series_all_en.zip
new file mode 100644
index 0000000..5cece13
--- /dev/null
+++ b/tests/thetvdb/data/house_series_all_en.zip
Binary files differ
diff --git a/tests/thetvdb/data/naruto_get_series.txt b/tests/thetvdb/data/naruto_get_series.txt
new file mode 100644
index 0000000..7b285da
--- /dev/null
+++ b/tests/thetvdb/data/naruto_get_series.txt
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<Data>
+<Series>
+<seriesid>78857</seriesid>
+<language>en</language>
+<SeriesName>Naruto</SeriesName>
+<banner>graphical/78857-g3.jpg</banner>
+<Overview>In another world, ninja are the ultimate power, and in the Village Hidden in the Leaves live the stealthiest ninja in the land. Twelve years earlier, the fearsome Nine-Tailed Fox terrorized the village and claimed many lives before it was subdued and its spirit sealed within the body of a baby boy. That boy, Naruto Uzumaki, has grown up to become a ninja-in-training who's more interested in pranks than in studying ninjutsu.. but Naruto is determined to become the greatest ninja ever!</Overview>
+<FirstAired>2002-10-03</FirstAired>
+<Network>TV Tokyo</Network>
+<IMDB_ID>tt0409591</IMDB_ID>
+<zap2it_id>SH774951</zap2it_id>
+<id>78857</id>
+</Series>
+<Series>
+<seriesid>79824</seriesid>
+<language>en</language>
+<SeriesName>Naruto Shippuden</SeriesName>
+<AliasNames>Naruto Shipp?den|Naruto Shippuuden</AliasNames>
+<banner>graphical/79824-g3.jpg</banner>
+<Overview>Naruto: Shippuden is an anime series adapted from Part II of the Naruto manga series by Masashi Kishimoto. The series is directed by Hayato Date and produced by Studio Pierrot and TV Tokyo. Naruto: Shippuden is a continuation of the Naruto manga, and continues the same storyline after the passing of two and a half years in the Naruto universe. It began broadcasting on TV Tokyo on February 15, 2007.</Overview>
+<FirstAired>2008-11-11</FirstAired>
+<Network>TV Tokyo</Network>
+<IMDB_ID>tt0988824</IMDB_ID>
+<id>79824</id>
+</Series>
+<Series>
+<seriesid>257837</seriesid>
+<language>en</language>
+<SeriesName>Rock Lee &amp; His Ninja Pals</SeriesName>
+<AliasNames>Naruto SD: Rock Lee no Seishun Full-Power Ninden|Naruto Spin-Off: Rock Lee &amp; His Ninja Pals|Ranked #0 Rock Lee no Seishun Full-Power Ninden</AliasNames>
+<banner>graphical/257837-g2.jpg</banner>
+<Overview>Welcome to the Hidden Leaf Village. The village where Uzumaki Naruto, star of the TV show "Naruto" makes his home. Every day, countless powerful ninjas carry out missions and train to hone their skills. Our main character is one of these powerful ninjas...but it's not Naruto! It's the ninja who can't use ninjutsu, Rock Lee! In spite of his handicap, Lee has big dreams. He works hard every day to perfect his hand-to-hand combat skills and become a splendid ninja! And to achieve his dream, he puts in more effort than anyone else. Under the hot-blooded tutelage of his teacher Guy, he works alongside his teammates Tenten and Neji. Watch the Beautiful Green Beast Rock Lee train, go on missions, and have all sorts of adventures! </Overview>
+<FirstAired>2012-04-03</FirstAired>
+<Network>TV Tokyo</Network>
+<IMDB_ID>tt2301807</IMDB_ID>
+<id>257837</id>
+</Series>
+</Data>
diff --git a/tests/thetvdb/data/naruto_series_all_en.zip b/tests/thetvdb/data/naruto_series_all_en.zip
new file mode 100644
index 0000000..acb45ad
--- /dev/null
+++ b/tests/thetvdb/data/naruto_series_all_en.zip
Binary files differ
diff --git a/tests/thetvdb/test_thetvdb_resolve_episodes.c b/tests/thetvdb/test_thetvdb_resolve_episodes.c
new file mode 100644
index 0000000..05643a0
--- /dev/null
+++ b/tests/thetvdb/test_thetvdb_resolve_episodes.c
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2014. All rights reserved.
+ *
+ * Author: Victor Toso <me@victortoso.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include "test_thetvdb_utils.h"
+#include <grilo.h>
+
+static void
+get_episode_metadata_from_episode (GrlSource *source,
+ const gchar *show,
+ gint season,
+ gint episode,
+ gchar **imdb,
+ gchar **tvdb_id,
+ gchar **zap2it,
+ gchar **publication_date,
+ gchar **title,
+ gchar **episode_screen)
+{
+ GrlMediaVideo *video;
+ GrlOperationOptions *options;
+ GList *keys;
+ GDateTime *date;
+ GrlRegistry *registry;
+ GrlKeyID tvdb_key, imdb_key, zap2it_key, ss_key;
+
+ registry = grl_registry_get_default ();
+
+ tvdb_key = grl_registry_lookup_metadata_key (registry, "thetvdb-id");
+ imdb_key = grl_registry_lookup_metadata_key (registry, "thetvdb-imdb-id");
+ zap2it_key = grl_registry_lookup_metadata_key (registry, "thetvdb-zap2it-id");
+ ss_key = grl_registry_lookup_metadata_key (registry, "thetvdb-episode-screenshot");
+
+ g_assert_cmpint (tvdb_key, !=, GRL_METADATA_KEY_INVALID);
+ g_assert_cmpint (imdb_key, !=, GRL_METADATA_KEY_INVALID);
+ g_assert_cmpint (zap2it_key, !=, GRL_METADATA_KEY_INVALID);
+ g_assert_cmpint (ss_key, !=, GRL_METADATA_KEY_INVALID);
+
+ video = GRL_MEDIA_VIDEO (grl_media_video_new ());
+ grl_media_video_set_show (video, show);
+ grl_media_video_set_season (video, season);
+ grl_media_video_set_episode (video, episode);
+
+ keys = grl_metadata_key_list_new (GRL_METADATA_KEY_TITLE,
+ GRL_METADATA_KEY_PUBLICATION_DATE,
+ tvdb_key,
+ imdb_key,
+ zap2it_key,
+ ss_key,
+ NULL);
+
+ options = grl_operation_options_new (NULL);
+ grl_operation_options_set_flags (options, GRL_RESOLVE_NORMAL);
+
+ grl_source_resolve_sync (source,
+ GRL_MEDIA (video),
+ keys,
+ options,
+ NULL);
+ *title = g_strdup (grl_media_get_title (GRL_MEDIA (video)));
+ *imdb = g_strdup (grl_data_get_string (GRL_DATA (video), imdb_key));
+ *tvdb_id = g_strdup (grl_data_get_string (GRL_DATA (video), tvdb_key));
+ *zap2it = g_strdup (grl_data_get_string (GRL_DATA (video), zap2it_key));
+ *episode_screen = g_strdup (grl_data_get_string (GRL_DATA (video), ss_key));
+
+ date = grl_media_get_publication_date (GRL_MEDIA (video));
+ *publication_date = g_date_time_format (date, "%Y-%m-%d");
+
+ g_list_free (keys);
+ g_object_unref (options);
+ g_object_unref (video);
+}
+
+static void
+test_episodes_from_episode (void)
+{
+ GrlSource *source;
+ guint i;
+
+ struct {
+ gchar *show;
+ gchar *title;
+ gint season;
+ gint episode;
+ gchar *imdb;
+ gchar *tvdb_id;
+ gchar *zap2it_id;
+ gchar *publication_date;
+ gchar *url_episode_screen;
+ } videos[] = {
+ { "Boardwalk Empire", "New York Sour", 4, 1,
+ "tt2483070", "4596908", "SH01308836", "2013-09-08",
+ "http://thetvdb.com/banners/episodes/84947/4596908.jpg" },
+ { "Adventure Time", "It Came from the Nightosphere", 2, 1,
+ "tt1305826", "2923061", "EP01246265", "2010-10-11",
+ "http://thetvdb.com/banners/episodes/152831/2923061.jpg" },
+ { "Felicity", "The Last Stand", 1, 2,
+ "tt0134247", "133911", "SH184561", "1998-10-06",
+ "http://thetvdb.com/banners/episodes/73980/133911.jpg" },
+ { "House", "Everybody Dies", 8, 22,
+ "tt2121965", "4265769", "EP00688359", "2012-05-21",
+ "http://thetvdb.com/banners/episodes/73255/4265769.jpg" },
+ { "Naruto", "Yakumo's Sealed Power", 5, 25,
+ "tt0409591", "446714", "SH774951", "2006-10-05",
+ "http://thetvdb.com/banners/episodes/78857/446714.jpg" }
+ };
+
+ source = test_get_source();
+ g_assert (source);
+
+ for (i = 0; i < G_N_ELEMENTS (videos); i++) {
+ gchar *imdb, *tvdb_id, *zap2it_id, *pdate, *title, *url_episode_screen;
+
+ get_episode_metadata_from_episode (source, videos[i].show, videos[i].season,
+ videos[i].episode, &imdb, &tvdb_id,
+ &zap2it_id, &pdate, &title,
+ &url_episode_screen);
+ g_assert_cmpstr (videos[i].imdb, ==, imdb);
+ g_free (imdb);
+ g_assert_cmpstr (videos[i].tvdb_id, ==, tvdb_id);
+ g_free (tvdb_id);
+ g_assert_cmpstr (videos[i].zap2it_id, ==, zap2it_id);
+ g_free (zap2it_id);
+ g_assert_cmpstr (videos[i].publication_date, ==, pdate);
+ g_free (pdate);
+ g_assert_cmpstr (videos[i].title, ==, title);
+ g_free (title);
+ /* Those urls may change due up/down vote at tvdb system,
+ * just shot a message if they change, do not fail the test. */
+ if (g_strcmp0 (videos[i].url_episode_screen, url_episode_screen) != 0)
+ g_message ("[%s] Episode screen changed from %s to %s",
+ videos[i].show, videos[i].url_episode_screen, url_episode_screen);
+ g_free (url_episode_screen);
+ }
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+ g_setenv ("GRL_PLUGIN_PATH", THETVDB_PLUGIN_PATH, TRUE);
+ g_setenv ("GRL_PLUGIN_LIST", THETVDB_ID, TRUE);
+ g_setenv ("GRL_NET_MOCKED", THETVDB_PLUGIN_TEST_DATA_PATH "config.ini", TRUE);
+
+ grl_init (&argc, &argv);
+ g_test_init (&argc, &argv, NULL);
+
+#if !GLIB_CHECK_VERSION(2,32,0)
+ g_thread_init (NULL);
+#endif
+
+ test_setup_thetvdb ();
+
+ g_test_add_func ("/thetvdb/resolve/episodes_from_episode", test_episodes_from_episode);
+
+ gint result = g_test_run ();
+
+ test_shutdown_thetvdb ();
+
+ grl_deinit ();
+
+ return result;
+}
diff --git a/tests/thetvdb/test_thetvdb_resolve_shows.c b/tests/thetvdb/test_thetvdb_resolve_shows.c
new file mode 100644
index 0000000..9acfce3
--- /dev/null
+++ b/tests/thetvdb/test_thetvdb_resolve_shows.c
@@ -0,0 +1,194 @@
+/*
+ * Copyright (C) 2014. All rights reserved.
+ *
+ * Author: Victor Toso <me@victortoso.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include "test_thetvdb_utils.h"
+#include <grilo.h>
+
+static void
+get_show_metadata (GrlSource *source,
+ const gchar *show,
+ gchar **imdb,
+ gchar **tvdb_id,
+ gchar **zap2it,
+ gchar **publication_date,
+ gchar **banner,
+ gchar **fanart,
+ gchar **poster)
+{
+ GrlMediaVideo *video;
+ GrlOperationOptions *options;
+ GList *keys;
+ GDateTime *date;
+ GrlRegistry *registry;
+ GrlKeyID tvdb_key, imdb_key, zap2it_key, fanart_key, banner_key, poster_key;
+
+ registry = grl_registry_get_default ();
+
+ tvdb_key = grl_registry_lookup_metadata_key (registry, "thetvdb-id");
+ imdb_key = grl_registry_lookup_metadata_key (registry, "thetvdb-imdb-id");
+ zap2it_key = grl_registry_lookup_metadata_key (registry, "thetvdb-zap2it-id");
+ fanart_key = grl_registry_lookup_metadata_key (registry, "thetvdb-fanart");
+ banner_key = grl_registry_lookup_metadata_key (registry, "thetvdb-banner");
+ poster_key = grl_registry_lookup_metadata_key (registry, "thetvdb-poster");
+
+ g_assert_cmpint (tvdb_key, !=, GRL_METADATA_KEY_INVALID);
+ g_assert_cmpint (imdb_key, !=, GRL_METADATA_KEY_INVALID);
+ g_assert_cmpint (zap2it_key, !=, GRL_METADATA_KEY_INVALID);
+ g_assert_cmpint (fanart_key, !=, GRL_METADATA_KEY_INVALID);
+ g_assert_cmpint (banner_key, !=, GRL_METADATA_KEY_INVALID);
+ g_assert_cmpint (poster_key, !=, GRL_METADATA_KEY_INVALID);
+
+ video = GRL_MEDIA_VIDEO (grl_media_video_new ());
+ grl_media_video_set_show (video, show);
+
+ keys = grl_metadata_key_list_new (GRL_METADATA_KEY_PUBLICATION_DATE,
+ tvdb_key,
+ imdb_key,
+ zap2it_key,
+ fanart_key,
+ banner_key,
+ poster_key,
+ NULL);
+
+ options = grl_operation_options_new (NULL);
+ grl_operation_options_set_flags (options, GRL_RESOLVE_NORMAL);
+
+ grl_source_resolve_sync (source,
+ GRL_MEDIA (video),
+ keys,
+ options,
+ NULL);
+ *imdb = g_strdup (grl_data_get_string (GRL_DATA (video), imdb_key));
+ *tvdb_id = g_strdup (grl_data_get_string (GRL_DATA (video), tvdb_key));
+ *zap2it = g_strdup (grl_data_get_string (GRL_DATA (video), zap2it_key));
+ *banner = g_strdup (grl_data_get_string (GRL_DATA (video), banner_key));
+ *fanart = g_strdup (grl_data_get_string (GRL_DATA (video), fanart_key));
+ *poster = g_strdup (grl_data_get_string (GRL_DATA (video), poster_key));
+
+ date = grl_media_get_publication_date (GRL_MEDIA (video));
+ *publication_date = g_date_time_format (date, "%Y-%m-%d");
+
+ g_list_free (keys);
+ g_object_unref (options);
+ g_object_unref (video);
+}
+
+static void
+test_shows (void)
+{
+ GrlSource *source;
+ guint i;
+
+ struct {
+ gchar *show;
+ gchar *imdb;
+ gchar *tvdb_id;
+ gchar *zap2it_id;
+ gchar *publication_date;
+ gchar *url_banner;
+ gchar *url_fanart;
+ gchar *url_poster;
+ } videos[] = {
+ { "Boardwalk Empire", "tt0979432", "84947", "SH01308836", "2010-09-19",
+ "http://thetvdb.com/banners/graphical/84947-g6.jpg",
+ "http://thetvdb.com/banners/fanart/original/84947-12.jpg",
+ "http://thetvdb.com/banners/posters/84947-6.jpg" },
+ { "Adventure Time", "tt1305826", "152831", "EP01246265", "2010-04-05",
+ "http://thetvdb.com/banners/graphical/152831-g2.jpg",
+ "http://thetvdb.com/banners/fanart/original/152831-13.jpg",
+ "http://thetvdb.com/banners/posters/152831-2.jpg" },
+ { "Felicity", "tt0134247", "73980", "SH184561", "1998-09-29",
+ "http://thetvdb.com/banners/graphical/253-g.jpg",
+ "http://thetvdb.com/banners/fanart/original/73980-3.jpg",
+ "http://thetvdb.com/banners/posters/73980-4.jpg" },
+ { "House", "tt0412142", "73255", "EP00688359", "2004-11-16",
+ "http://thetvdb.com/banners/graphical/73255-g22.jpg",
+ "http://thetvdb.com/banners/fanart/original/73255-47.jpg",
+ "http://thetvdb.com/banners/posters/73255-13.jpg" },
+ { "Naruto", "tt0409591", "78857", "SH774951", "2002-10-03",
+ "http://thetvdb.com/banners/graphical/78857-g3.jpg",
+ "http://thetvdb.com/banners/fanart/original/78857-37.jpg",
+ "http://thetvdb.com/banners/posters/78857-10.jpg" }
+ };
+
+ source = test_get_source ();
+ g_assert (source);
+
+ for (i = 0; i < G_N_ELEMENTS (videos); i++) {
+ gchar *imdb, *tvdb_id, *zap2it, *pdate, *banner, *fanart, *poster;
+
+ get_show_metadata (source, videos[i].show,
+ &imdb, &tvdb_id, &zap2it, &pdate,
+ &banner, &fanart, &poster);
+ g_assert_cmpstr (videos[i].tvdb_id, ==, tvdb_id);
+ g_free (tvdb_id);
+ g_assert_cmpstr (videos[i].imdb, ==, imdb);
+ g_free (imdb);
+ g_assert_cmpstr (videos[i].zap2it_id, ==, zap2it);
+ g_free (zap2it);
+ g_assert_cmpstr (videos[i].publication_date, ==, pdate);
+ g_free (pdate);
+ /* Those urls may change due up/down vote at tvdb system,
+ * just shot a message if they change, do not fail the test. */
+ if (g_strcmp0 (videos[i].url_banner, banner) != 0)
+ g_message ("[%s] banner changed from %s to %s",
+ videos[i].show, videos[i].url_banner, banner);
+ g_free (banner);
+
+ if (g_strcmp0 (videos[i].url_fanart, fanart) != 0)
+ g_message ("[%s] fanart changed from %s to %s",
+ videos[i].show, videos[i].url_fanart, fanart);
+ g_free (fanart);
+
+ if (g_strcmp0 (videos[i].url_poster, poster) != 0)
+ g_message ("[%s] poster changed from %s to %s",
+ videos[i].show, videos[i].url_fanart, fanart);
+ g_free (poster);
+ }
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+ g_setenv ("GRL_PLUGIN_PATH", THETVDB_PLUGIN_PATH, TRUE);
+ g_setenv ("GRL_PLUGIN_LIST", THETVDB_ID, TRUE);
+ g_setenv ("GRL_NET_MOCKED", THETVDB_PLUGIN_TEST_DATA_PATH "config.ini", TRUE);
+
+ grl_init (&argc, &argv);
+ g_test_init (&argc, &argv, NULL);
+
+#if !GLIB_CHECK_VERSION(2,32,0)
+ g_thread_init (NULL);
+#endif
+
+ test_setup_thetvdb ();
+
+ g_test_add_func ("/thetvdb/resolve/shows", test_shows);
+
+ gint result = g_test_run ();
+
+ test_shutdown_thetvdb ();
+
+ grl_deinit ();
+
+ return result;
+}
diff --git a/tests/thetvdb/test_thetvdb_resolve_stress.c b/tests/thetvdb/test_thetvdb_resolve_stress.c
new file mode 100644
index 0000000..1a5f810
--- /dev/null
+++ b/tests/thetvdb/test_thetvdb_resolve_stress.c
@@ -0,0 +1,324 @@
+/*
+ * Copyright (C) 2014. All rights reserved.
+ *
+ * Author: Victor Toso <me@victortoso.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include "test_thetvdb_utils.h"
+#include <grilo.h>
+
+static gint num_tests;
+
+static GMainLoop *main_loop = NULL;
+
+static GrlKeyID tvdb_key, imdb_key, zap2it_key, ss_key;
+
+static struct {
+ gchar *show;
+ gchar *title;
+ gint season;
+ gint episode;
+ gchar *imdb;
+ gchar *tvdb_id;
+ gchar *zap2it_id;
+ gchar *publication_date;
+ gchar *url_episode_screen;
+} videos[] = {
+ {"House", "Now What?", 7, 1,
+ "tt1697219", "2495251","EP00688359","2010-09-20",
+ "http://thetvdb.com/banners/episodes/73255/2495251.jpg" },
+ {"House", "Selfish", 7, 2,
+ "tt1685104", "2756371","EP00688359","2010-09-27",
+ "http://thetvdb.com/banners/episodes/73255/2756371.jpg" },
+ {"House", "Unwritten", 7, 3,
+ "tt1726377", "2825851","EP00688359","2010-10-04",
+ "http://thetvdb.com/banners/episodes/73255/2825851.jpg" },
+ {"House", "Massage Therapy", 7, 4,
+ "tt1726378", "2878681","EP00688359","2010-10-11",
+ "http://thetvdb.com/banners/episodes/73255/2878681.jpg" },
+ {"House", "Unplanned Parenthood", 7, 5,
+ "tt1726379", "2878691","EP00688359","2010-10-18",
+ "http://thetvdb.com/banners/episodes/73255/2878691.jpg" },
+ {"House", "Office Politics", 7, 6,
+ "tt1708695", "2878701","EP00688359","2010-11-08",
+ "http://thetvdb.com/banners/episodes/73255/2878701.jpg" },
+ {"House", "A Pox on Our House", 7, 7,
+ "tt1726380", "2878711","EP00688359","2010-11-15",
+ "http://thetvdb.com/banners/episodes/73255/2878711.jpg" },
+ {"House", "A Pox on Our House", 7, 7,
+ "tt1726380", "2878711","EP00688359","2010-11-15",
+ "http://thetvdb.com/banners/episodes/73255/2878711.jpg" },
+ {"House", "Larger Than Life", 7, 9,
+ "tt1726382", "2861961","EP00688359","2011-01-17",
+ "http://thetvdb.com/banners/episodes/73255/2861961.jpg" },
+ {"House", "Carrot or Stick", 7, 10,
+ "tt1726371", "2861951","EP00688359","2011-01-24",
+ "http://thetvdb.com/banners/episodes/73255/2861951.jpg" },
+ {"House", "Family Practice", 7, 11,
+ "tt1726372", "3473831","EP00688359","2011-02-07",
+ "http://thetvdb.com/banners/episodes/73255/3473831.jpg" },
+ {"House", "You Must Remember This", 7, 12,
+ "tt1726373", "3553891","EP00688359","2011-02-14",
+ "http://thetvdb.com/banners/episodes/73255/3553891.jpg" },
+ {"House", "You Must Remember This", 7, 12,
+ "tt1726373", "3553891","EP00688359","2011-02-14",
+ "http://thetvdb.com/banners/episodes/73255/3553891.jpg" },
+ {"House", "Two Stories", 7, 13,
+ "tt1726374", "3565631","EP00688359","2011-02-21",
+ "http://thetvdb.com/banners/episodes/73255/3565631.jpg" },
+ {"House", "Recession Proof", 7, 14,
+ "tt1726375", "3565641","EP00688359","2011-02-28",
+ "http://thetvdb.com/banners/episodes/73255/3565641.jpg" },
+ {"House", "Bombshells", 7, 15,
+ "tt1726376", "3565651","EP00688359","2011-03-07",
+ "http://thetvdb.com/banners/episodes/73255/3565651.jpg" },
+ {"House", "Out of the Chute", 7, 16,
+ "tt1842688", "3565661","EP00688359","2011-03-14",
+ "http://thetvdb.com/banners/episodes/73255/3565661.jpg" },
+ {"House", "Fall from Grace", 7, 17,
+ "tt1842081", "3565671","EP00688359","2011-03-21",
+ "http://thetvdb.com/banners/episodes/73255/3565671.jpg" },
+ {"House", "Fall from Grace", 7, 17,
+ "tt1842081", "3565671","EP00688359","2011-03-21",
+ "http://thetvdb.com/banners/episodes/73255/3565671.jpg" },
+ {"House", "Last Temptation", 7, 19,
+ "tt1880571", "3934671","EP00688359","2011-04-18",
+ "http://thetvdb.com/banners/episodes/73255/3934671.jpg" },
+ {"House", "Changes", 7, 20,
+ "tt1883788", "3934691","EP00688359","2011-05-02",
+ "http://thetvdb.com/banners/episodes/73255/3934691.jpg" },
+ {"House", "The Fix", 7, 21,
+ "tt1902562", "3934761","EP00688359","2011-05-09",
+ "http://thetvdb.com/banners/episodes/73255/3934761.jpg" },
+ {"House", "After Hours", 7, 22,
+ "tt1900094", "3934781","EP00688359","2011-05-16",
+ "http://thetvdb.com/banners/episodes/73255/3934781.jpg" },
+ {"House", "Twenty Vicodin", 8, 1,
+ "tt2006450", "4120406","EP00688359","2011-10-03",
+ "http://thetvdb.com/banners/episodes/73255/4120406.jpg" },
+ {"House", "Transplant", 8, 2,
+ "tt2015677", "4155773","EP00688359","2011-10-10",
+ "http://thetvdb.com/banners/episodes/73255/4155773.jpg" },
+ {"House", "Charity Case", 8, 3,
+ "tt2016511", "4155774","EP00688359","2011-10-17",
+ "http://thetvdb.com/banners/episodes/73255/4155774.jpg" },
+ {"House", "Risky Business", 8, 4,
+ "tt2021267", "4159274","EP00688359","2011-10-31",
+ "http://thetvdb.com/banners/episodes/73255/4159274.jpg" },
+ {"House", "The Confession", 8, 5,
+ "tt2063276", "4176819","EP00688359","2011-11-07",
+ "http://thetvdb.com/banners/episodes/73255/4176819.jpg" },
+ {"House", "Parents", 8, 6,
+ "tt2084392", "4190490","EP00688359","2011-11-14",
+ "http://thetvdb.com/banners/episodes/73255/4190490.jpg" },
+ {"House", "Dead & Buried", 8, 7,
+ "tt2084393", "4190489","EP00688359","2011-11-21",
+ "http://thetvdb.com/banners/episodes/73255/4190489.jpg" },
+ {"House", "Perils of Paranoia", 8, 8,
+ "tt2084394", "4190488","EP00688359","2011-11-28",
+ "http://thetvdb.com/banners/episodes/73255/4190488.jpg" },
+ {"House", "Better Half", 8, 9,
+ "tt2092629", "4195884","EP00688359","2012-01-23",
+ "http://thetvdb.com/banners/episodes/73255/4195884.jpg" },
+ {"House", "Runaways", 8, 10,
+ "tt2121953", "4217133","EP00688359","2012-01-30",
+ "http://thetvdb.com/banners/episodes/73255/4217133.jpg" },
+ {"House", "Nobody's Fault", 8, 11,
+ "tt2121954", "4217134","EP00688359","2012-02-06",
+ "http://thetvdb.com/banners/episodes/73255/4217134.jpg" },
+ {"House", "Chase", 8, 12,
+ "tt2121955", "4217135","EP00688359","2012-02-13",
+ "http://thetvdb.com/banners/episodes/73255/4217135.jpg" },
+ {"House", "Chase", 8, 12,
+ "tt2121955", "4217135","EP00688359","2012-02-13",
+ "http://thetvdb.com/banners/episodes/73255/4217135.jpg" },
+ {"House", "Man of the House", 8, 13,
+ "tt2121956", "4225825","EP00688359","2012-02-20",
+ "http://thetvdb.com/banners/episodes/73255/4225825.jpg" },
+ {"House", "Love is Blind", 8, 14,
+ "tt2121957", "4225826","EP00688359","2012-03-19",
+ "http://thetvdb.com/banners/episodes/73255/4225826.jpg" },
+ {"House", "Blowing the Whistle", 8, 15,
+ "tt2121958", "4225827","EP00688359","2012-04-02",
+ "http://thetvdb.com/banners/episodes/73255/4225827.jpg" },
+ {"House", "Gut Check", 8, 16,
+ "tt2121959", "4265763","EP00688359","2012-04-09",
+ "http://thetvdb.com/banners/episodes/73255/4265763.jpg" },
+ {"House", "We Need the Eggs", 8, 17,
+ "tt2121960", "4265764","EP00688359","2012-04-16",
+ "http://thetvdb.com/banners/episodes/73255/4265764.jpg" },
+ {"House", "Body and Soul", 8, 18,
+ "tt2121961", "4265765","EP00688359","2012-04-23",
+ "http://thetvdb.com/banners/episodes/73255/4265765.jpg" },
+ {"House", "The C Word", 8, 19,
+ "tt2121962", "4265766","EP00688359","2012-04-30",
+ "http://thetvdb.com/banners/episodes/73255/4265766.jpg" },
+ {"House", "Post Mortem", 8, 20,
+ "tt2121963", "4265767","EP00688359","2012-05-07",
+ "http://thetvdb.com/banners/episodes/73255/4265767.jpg" },
+ {"House", "Holding On", 8, 21,
+ "tt2121964", "4265768","EP00688359","2012-05-14",
+ "http://thetvdb.com/banners/episodes/73255/4265768.jpg" },
+ {"House", "Everybody Dies", 8, 22,
+ "tt2121965", "4265769","EP00688359","2012-05-21",
+ "http://thetvdb.com/banners/episodes/73255/4265769.jpg" }
+};
+
+
+static void
+check_videos_metadata (GrlSource *source,
+ guint operation_id,
+ GrlMedia *media,
+ gpointer user_data,
+ const GError *error)
+{
+ GrlMediaVideo *video;
+ GDateTime *date;
+ const gchar *imdb;
+ const gchar *tvdb_id;
+ const gchar *zap2it;
+ const gchar *title;
+ const gchar *episode_screen;
+ gchar *publication_date;
+ gint i = GPOINTER_TO_INT (user_data);
+
+ if (error)
+ g_error ("Resolve operation failed. Reason: %s", error->message);
+
+ video = GRL_MEDIA_VIDEO (media);
+
+ title = grl_media_get_title (GRL_MEDIA (video));
+ g_assert_cmpstr (videos[i].title, ==, title);
+
+ imdb = grl_data_get_string (GRL_DATA (video), imdb_key);
+ g_assert_cmpstr (videos[i].imdb, ==, imdb);
+
+ tvdb_id = grl_data_get_string (GRL_DATA (video), tvdb_key);
+ g_assert_cmpstr (videos[i].tvdb_id, ==, tvdb_id);
+
+ zap2it = grl_data_get_string (GRL_DATA (video), zap2it_key);
+ g_assert_cmpstr (videos[i].zap2it_id, ==, zap2it);
+
+ date = grl_media_get_publication_date (GRL_MEDIA (video));
+ publication_date = g_date_time_format (date, "%Y-%m-%d");
+ g_assert_cmpstr (videos[i].publication_date, ==, publication_date);
+ g_free (publication_date);
+
+ episode_screen = grl_data_get_string (GRL_DATA (video), ss_key);
+ if (g_strcmp0 (videos[i].url_episode_screen, episode_screen) != 0)
+ g_message ("[%s] Episode screen changed from %s to %s",
+ videos[i].show, videos[i].url_episode_screen, episode_screen);
+
+ num_tests--;
+ if (num_tests == 0)
+ g_main_loop_quit (main_loop);
+}
+
+static void
+test_episodes_stress (void)
+{
+ GrlSource *source;
+ guint i;
+ GrlRegistry *registry;
+ GrlOperationOptions *options;
+ GList *keys;
+ GrlCaps *caps;
+
+ source = test_get_source();
+ g_assert (source);
+
+ if (!(grl_source_supported_operations (source) & GRL_OP_RESOLVE))
+ g_error ("Source is not searchable!");
+
+ registry = grl_registry_get_default ();
+
+ tvdb_key = grl_registry_lookup_metadata_key (registry, "thetvdb-id");
+ imdb_key = grl_registry_lookup_metadata_key (registry, "thetvdb-imdb-id");
+ zap2it_key = grl_registry_lookup_metadata_key (registry, "thetvdb-zap2it-id");
+ ss_key = grl_registry_lookup_metadata_key (registry, "thetvdb-episode-screenshot");
+
+ g_assert_cmpint (tvdb_key, !=, GRL_METADATA_KEY_INVALID);
+ g_assert_cmpint (imdb_key, !=, GRL_METADATA_KEY_INVALID);
+ g_assert_cmpint (zap2it_key, !=, GRL_METADATA_KEY_INVALID);
+ g_assert_cmpint (ss_key, !=, GRL_METADATA_KEY_INVALID);
+
+ caps = grl_source_get_caps (source, GRL_OP_RESOLVE);
+ options = grl_operation_options_new (caps);
+ grl_operation_options_set_flags (options, GRL_RESOLVE_NORMAL);
+
+ keys = grl_metadata_key_list_new (GRL_METADATA_KEY_TITLE,
+ GRL_METADATA_KEY_PUBLICATION_DATE,
+ tvdb_key,
+ imdb_key,
+ zap2it_key,
+ ss_key,
+ GRL_METADATA_KEY_INVALID);
+
+ for (i = 0; i < G_N_ELEMENTS (videos); i++) {
+ GrlMediaVideo *video;
+
+ video = GRL_MEDIA_VIDEO (grl_media_video_new ());
+ grl_media_video_set_show (video, videos[i].show);
+ grl_media_video_set_season (video, videos[i].season);
+ grl_media_video_set_episode (video, videos[i].episode);
+
+ grl_source_resolve (source,
+ GRL_MEDIA (video),
+ keys,
+ options,
+ check_videos_metadata,
+ GINT_TO_POINTER (i));
+
+ g_object_unref (video);
+ }
+ g_object_unref (options);
+ g_object_unref (caps);
+ g_list_free (keys);
+
+ num_tests = i;
+ main_loop = g_main_loop_new (NULL, FALSE);
+ g_main_loop_run (main_loop);
+}
+
+gint
+main (gint argc, gchar **argv)
+{
+ g_setenv ("GRL_PLUGIN_PATH", THETVDB_PLUGIN_PATH, TRUE);
+ g_setenv ("GRL_PLUGIN_LIST", THETVDB_ID, TRUE);
+ g_setenv ("GRL_NET_MOCKED", THETVDB_PLUGIN_TEST_DATA_PATH "config.ini", TRUE);
+
+ grl_init (&argc, &argv);
+ g_test_init (&argc, &argv, NULL);
+
+#if !GLIB_CHECK_VERSION(2,32,0)
+ g_thread_init (NULL);
+#endif
+
+ test_setup_thetvdb ();
+
+ g_test_add_func ("/thetvdb/resolve/episodes_from_episode", test_episodes_stress);
+
+ gint result = g_test_run ();
+
+ test_shutdown_thetvdb ();
+
+ grl_deinit ();
+
+ return result;
+}
diff --git a/tests/thetvdb/test_thetvdb_utils.c b/tests/thetvdb/test_thetvdb_utils.c
new file mode 100644
index 0000000..ef9ab7e
--- /dev/null
+++ b/tests/thetvdb/test_thetvdb_utils.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2014. All rights reserved.
+ *
+ * Author: Victor Toso <me@victortoso.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#include <grilo.h>
+#include "test_thetvdb_utils.h"
+
+GrlSource *source = NULL;
+
+void
+test_setup_thetvdb (void)
+{
+ GrlConfig *config;
+ GrlRegistry *registry;
+ GError *error = NULL;
+
+ config = grl_config_new (THETVDB_ID, NULL);
+ grl_config_set_api_key (config, "THETVDB_TEST_MOCK_API_KEY");
+
+ registry = grl_registry_get_default ();
+ grl_registry_add_config (registry, config, &error);
+ g_assert_no_error (error);
+
+ grl_registry_load_plugin_by_id (registry, THETVDB_ID, &error);
+ g_assert_no_error (error);
+
+ source = GRL_SOURCE (grl_registry_lookup_source (registry, THETVDB_ID));
+ g_assert (source != NULL);
+
+ g_assert (grl_source_supported_operations (source) & GRL_OP_RESOLVE);
+}
+
+GrlSource* test_get_source (void)
+{
+ return source;
+}
+
+void
+test_shutdown_thetvdb (void)
+{
+ GrlRegistry *registry;
+ GError *error = NULL;
+
+ registry = grl_registry_get_default ();
+ grl_registry_unload_plugin (registry, THETVDB_ID, &error);
+ g_assert_no_error (error);
+}
diff --git a/tests/thetvdb/test_thetvdb_utils.h b/tests/thetvdb/test_thetvdb_utils.h
new file mode 100644
index 0000000..746bec2
--- /dev/null
+++ b/tests/thetvdb/test_thetvdb_utils.h
@@ -0,0 +1,35 @@
+/*
+ * Copyright (C) 2014. All rights reserved.
+ *
+ * Author: Victor Toso <me@victortoso.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef _GRL_THETVDB_TEST_UTILS_H_
+#define _GRL_THETVDB_TEST_UTILS_H_
+
+#include <grilo.h>
+
+#define THETVDB_ID "grl-thetvdb"
+#define TEST_PATH "data/"
+
+void test_setup_thetvdb (void);
+GrlSource* test_get_source (void);
+void test_shutdown_thetvdb (void);
+
+#endif /* _GRL_THETVDB_TEST_UTILS_H_ */