2014-04-26 20:12:58 +00:00
|
|
|
# coding=UTF-8
|
|
|
|
# Author: Dennis Lutter <lad1337@gmail.com>
|
|
|
|
# URL: http://code.google.com/p/sickbeard/
|
|
|
|
#
|
|
|
|
# This file is part of Sick Beard.
|
|
|
|
#
|
|
|
|
# Sick Beard is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# Sick Beard 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 General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with Sick Beard. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
from __future__ import with_statement
|
|
|
|
|
|
|
|
import unittest
|
|
|
|
import sys, os.path
|
2014-04-27 22:51:52 +00:00
|
|
|
import datetime
|
2014-04-26 20:12:58 +00:00
|
|
|
|
|
|
|
sys.path.append(os.path.abspath('..'))
|
|
|
|
sys.path.append(os.path.abspath('../lib'))
|
|
|
|
|
|
|
|
import test_lib as test
|
|
|
|
import sickbeard
|
2014-05-02 00:57:51 +00:00
|
|
|
from sickbeard.helpers import sanitizeSceneName
|
|
|
|
from sickbeard.name_parser.parser import NameParser
|
2014-04-27 10:31:54 +00:00
|
|
|
from sickbeard.tv import TVShow
|
2014-04-26 20:12:58 +00:00
|
|
|
|
|
|
|
class XEMBasicTests(test.SickbeardTestDBCase):
|
2014-05-03 09:23:26 +00:00
|
|
|
def loadShowsFromDB(self):
|
|
|
|
"""
|
|
|
|
Populates the showList with shows from the database
|
|
|
|
"""
|
|
|
|
|
|
|
|
myDB = test.db.DBConnection()
|
|
|
|
sqlResults = myDB.select("SELECT * FROM tv_shows")
|
|
|
|
|
|
|
|
for sqlShow in sqlResults:
|
|
|
|
try:
|
|
|
|
curShow = TVShow(int(sqlShow["indexer"]), int(sqlShow["indexer_id"]))
|
|
|
|
sickbeard.showList.append(curShow)
|
|
|
|
except Exception:
|
|
|
|
pass
|
|
|
|
|
2014-04-26 20:12:58 +00:00
|
|
|
def loadFromDB(self):
|
|
|
|
"""
|
|
|
|
Populates the showList with shows from the database
|
|
|
|
"""
|
|
|
|
|
|
|
|
myDB = test.db.DBConnection()
|
|
|
|
sqlResults = myDB.select("SELECT * FROM tv_shows")
|
|
|
|
|
|
|
|
for sqlShow in sqlResults:
|
|
|
|
try:
|
|
|
|
curShow = TVShow(int(sqlShow["indexer"]), int(sqlShow["indexer_id"]))
|
|
|
|
sickbeard.showList.append(curShow)
|
|
|
|
except Exception, e:
|
|
|
|
print "There was an error creating the show"
|
|
|
|
|
2014-05-01 11:36:16 +00:00
|
|
|
def test_formating(self):
|
2014-05-03 09:23:26 +00:00
|
|
|
release = "UFC.172.26th.April.2014.HDTV.x264.720p-Sir.Paul[rartv]"
|
2014-05-02 00:57:51 +00:00
|
|
|
# parse the name to break it into show name, season, and episode
|
|
|
|
np = NameParser(file)
|
|
|
|
parse_result = np.parse(release).convert()
|
2014-05-05 03:04:46 +00:00
|
|
|
airdate = parse_result.sports_event_date.toordinal()
|
2014-05-01 11:36:16 +00:00
|
|
|
|
2014-05-02 00:57:51 +00:00
|
|
|
print(parse_result)
|
2014-04-30 22:07:18 +00:00
|
|
|
|
2014-04-26 20:12:58 +00:00
|
|
|
if __name__ == "__main__":
|
|
|
|
print "=================="
|
|
|
|
print "STARTING - XEM Scene Numbering TESTS"
|
|
|
|
print "=================="
|
|
|
|
print "######################################################################"
|
|
|
|
suite = unittest.TestLoader().loadTestsFromTestCase(XEMBasicTests)
|