Skip to content

Commit

Permalink
Merge branch 'fixes/0.24' of github.com:MythTV/mythtv into jyavenard/…
Browse files Browse the repository at this point in the history
…backports/fixes/0.24

Conflicts:
	mythtv/programs/mythtranscode/transcode.cpp
  • Loading branch information
jyavenard committed Nov 16, 2011
2 parents 12796e6 + 088335b commit 32952c9
Show file tree
Hide file tree
Showing 14 changed files with 162 additions and 139 deletions.
22 changes: 12 additions & 10 deletions mythtv/bindings/python/MythTV/system.py
Expand Up @@ -147,16 +147,18 @@ def _fillNone(self):

def _process(self, xml):
for element in xml.getchildren():
if element.tag in self:
if (element.text == '') or (element.text is None):
self[element.tag] = None
else:
self[element.tag] = \
self._trans[self._global_type[element.tag]]\
(element.text)
if element.tag in self._groups:
self.__dict__[element.tag] = \
eval('self.%s(element)' % element.tag.capitalize())
try:
if element.tag in self:
if (element.text == '') or (element.text is None):
self[element.tag] = None
else:
self[element.tag] = \
self._trans[self._global_type[element.tag]]\
(element.text)
if element.tag in self._groups:
self.__dict__[element.tag] = \
eval('self.%s(element)' % element.tag.capitalize())
except: pass

class VideoMetadata( Metadata ):
_field_order = ['title','subtitle','tagline','description','season',
Expand Down
86 changes: 63 additions & 23 deletions mythtv/bindings/python/MythTV/tmdb/tmdb_api.py
Expand Up @@ -19,7 +19,7 @@
for this api are published at http://api.themoviedb.org/2.1/
'''

__version__="v0.2.5"
__version__="v0.2.6"
# 0.1.0 Initial development
# 0.1.1 Alpha Release
# 0.1.2 Added removal of any line-feeds from data
Expand All @@ -41,6 +41,8 @@
# 0.2.4 Added width and height attributes to images
# 0.2.5 Added a replace text XPatch extention so that "person" full size images can be created from
# the thumbnail.
# 0.2.6 Fixed processing publish date when it is a 'UTC' date
# Code line length clean up

import os, struct, sys, time
import urllib, urllib2
Expand Down Expand Up @@ -348,23 +350,38 @@ def __init__(self,
self.config[u'urls'] = {}

# v2.1 api calls
self.config[u'urls'][u'movie.search'] = u'%(base_url)s/Movie.search/%(language)s/xml/%(apikey)s/%%s' % (self.config)
self.config[u'urls'][u'tmdbid.search'] = u'%(base_url)s/Movie.getInfo/%(language)s/xml/%(apikey)s/%%s' % (self.config)
self.config[u'urls'][u'imdb.search'] = u'%(base_url)s/Movie.imdbLookup/%(language)s/xml/%(apikey)s/tt%%s' % (self.config)
self.config[u'urls'][u'image.search'] = u'%(base_url)s/Movie.getImages/%(language)s/xml/%(apikey)s/%%s' % (self.config)
self.config[u'urls'][u'person.search'] = u'%(base_url)s/Person.search/%(language)s/xml/%(apikey)s/%%s' % (self.config)
self.config[u'urls'][u'person.info'] = u'%(base_url)s/Person.getInfo/%(language)s/xml/%(apikey)s/%%s' % (self.config)
self.config[u'urls'][u'hash.info'] = u'%(base_url)s/Hash.getInfo/%(language)s/xml/%(apikey)s/%%s' % (self.config)
self.config[u'urls'][u'movie.search'] = \
u'%(base_url)s/Movie.search/%(language)s/xml/%(apikey)s/%%s' % (self.config)
self.config[u'urls'][u'tmdbid.search'] = \
u'%(base_url)s/Movie.getInfo/%(language)s/xml/%(apikey)s/%%s' % (self.config)
self.config[u'urls'][u'imdb.search'] = \
u'%(base_url)s/Movie.imdbLookup/%(language)s/xml/%(apikey)s/tt%%s' % (self.config)
self.config[u'urls'][u'image.search'] = \
u'%(base_url)s/Movie.getImages/%(language)s/xml/%(apikey)s/%%s' % (self.config)
self.config[u'urls'][u'person.search'] = \
u'%(base_url)s/Person.search/%(language)s/xml/%(apikey)s/%%s' % (self.config)
self.config[u'urls'][u'person.info'] = \
u'%(base_url)s/Person.getInfo/%(language)s/xml/%(apikey)s/%%s' % (self.config)
self.config[u'urls'][u'hash.info'] = \
u'%(base_url)s/Hash.getInfo/%(language)s/xml/%(apikey)s/%%s' % (self.config)

# Translation of TMDB elements into MythTV keys/db grabber names
self.config[u'mythtv_translation'] = {u'actor': u'cast', u'backdrop': u'fanart', u'categories': u'genres', u'director': u'director', u'id': u'inetref', u'name': u'title', u'overview': u'plot', u'rating': u'userrating', u'poster': u'coverart', u'production_countries': u'countries', u'released': u'releasedate', u'runtime': u'runtime', u'url': u'url', u'imdb_id': u'imdb', u'certification': u'movierating', }
self.config[u'mythtv_translation'] = {\
u'actor': u'cast', u'backdrop': u'fanart', u'categories': u'genres',
u'director': u'director', u'id': u'inetref', u'name': u'title',
u'overview': u'plot', u'rating': u'userrating', u'poster': u'coverart',
u'production_countries': u'countries', u'released': u'releasedate',
u'runtime': u'runtime', u'url': u'url', u'imdb_id': u'imdb',
u'certification': u'movierating', }
self.config[u'image_extentions'] = ["png", "jpg", "bmp"] # Acceptable image extentions
self.thumbnails = False
self.xml = False
self.pubDateFormat = u'%a, %d %b %Y %H:%M:%S GMT'
self.xmlParser = eTree.HTMLParser(remove_blank_text=True)
self.baseProcessingDir = os.path.dirname( os.path.realpath( __file__ ))
self.supportedJobList = ["actor", "author", "producer", "executive producer", "director", "cinematographer", "composer", "editor", "casting", ]
self.supportedJobList = [\
"actor", "author", "producer", "executive producer",
"director", "cinematographer", "composer", "editor", "casting", ]
self.tagTranslations = {
'poster': 'coverart',
'backdrop': 'fanart',
Expand Down Expand Up @@ -406,9 +423,9 @@ def textUtf8(self, text):


def getCategories(self, categories_et):
"""Takes an element tree Element ('categories') and create a string of comma seperated film
"""Takes an element tree Element ('categories') and create a string of comma separated film
categories
return comma seperated sting of film category names
return comma separated string of film category names
For example:
<categories>
Expand All @@ -430,9 +447,9 @@ def getCategories(self, categories_et):


def getStudios(self, studios_et):
"""Takes an element tree Element ('studios') and create a string of comma seperated film
"""Takes an element tree Element ('studios') and create a string of comma separated film
studios names
return comma seperated sting of film studios names
return comma separated string of film studios names
For example:
<studios>
Expand All @@ -452,9 +469,9 @@ def getStudios(self, studios_et):
return cat

def getProductionCountries(self, countries_et):
"""Takes an element tree Element ('countries') and create a string of comma seperated film
"""Takes an element tree Element ('countries') and create a string of comma separated film
countries
return comma seperated sting of countries associated with the film
return comma separated string of countries associated with the film
For example:
<countries>
Expand Down Expand Up @@ -601,6 +618,9 @@ def searchTitle(self, title, lang=False):
prepend += '\.'
title = prepend + title.lstrip('.')

# strip out question marks
title = title.replace('?','')

title = urllib.quote(title.encode("utf-8"))

url = URL % (title)
Expand Down Expand Up @@ -937,16 +957,21 @@ def lastUpdated(self, context, *inputArgs):
try:
if len(args) > 1:
args[1] = args[1].replace(',', u'').replace('.', u'')
if args[1].find('GMT') != -1:
args[1] = args[1][:args[1].find('GMT')].strip()
args[0] = args[0][:args[0].rfind(' ')].strip()
for cutOff in ['GMT', 'UTC']:
if args[1].find(cutOff) != -1:
args[1] = args[1][:args[1].find(cutOff)].strip()
args[0] = args[0][:args[0].rfind(' ')].strip()
if args[0].find(cutOff) != -1:
args[0] = args[0][:args[0].find(cutOff)].strip()
try:
pubdate = time.strptime(args[0], args[1])
except ValueError:
if args[1] == '%a %d %b %Y %H:%M:%S':
pubdate = time.strptime(args[0], '%a %d %B %Y %H:%M:%S')
elif args[1] == '%a %d %B %Y %H:%M:%S':
pubdate = time.strptime(args[0], '%a %d %b %Y %H:%M:%S')
else:
pubdate = datetime.datetime.now().strftime(self.pubDateFormat)
if len(args) > 2:
return time.strftime(args[2], pubdate)
else:
Expand Down Expand Up @@ -1133,8 +1158,19 @@ def __init__(self, apikey, mythtv, interactive, select_first, debug, custom_ui,
super(Videos, self).__init__(apikey, mythtv, interactive, select_first, debug, custom_ui, language, search_all_languages, )
# end __init__()

error_messages = {'TmdHttpError': u"! Error: A connection error to themoviedb.org was raised (%s)\n", 'TmdXmlError': u"! Error: Invalid XML was received from themoviedb.org (%s)\n", 'TmdBaseError': u"! Error: A user interface error was raised (%s)\n", 'TmdbUiAbort': u"! Error: A user interface input error was raised (%s)\n", }
key_translation = [{'channel_title': 'channel_title', 'channel_link': 'channel_link', 'channel_description': 'channel_description', 'channel_numresults': 'channel_numresults', 'channel_returned': 'channel_returned', 'channel_startindex': 'channel_startindex'}, {'title': 'item_title', 'item_author': 'item_author', 'releasedate': 'item_pubdate', 'overview': 'item_description', 'url': 'item_link', 'trailer': 'item_url', 'runtime': 'item_duration', 'userrating': 'item_rating', 'width': 'item_width', 'height': 'item_height', 'language': 'item_lang'}]
error_messages = {\
'TmdHttpError': u"! Error: A connection error to themoviedb.org was raised (%s)\n",
'TmdXmlError': u"! Error: Invalid XML was received from themoviedb.org (%s)\n",
'TmdBaseError': u"! Error: A user interface error was raised (%s)\n",
'TmdbUiAbort': u"! Error: A user interface input error was raised (%s)\n", }
key_translation = [{\
'channel_title': 'channel_title', 'channel_link': 'channel_link', 'channel_description':
'channel_description', 'channel_numresults': 'channel_numresults', 'channel_returned':
'channel_returned', 'channel_startindex': 'channel_startindex'},
{'title': 'item_title', 'item_author': 'item_author', 'releasedate':
'item_pubdate', 'overview': 'item_description', 'url': 'item_link', 'trailer': 'item_url',
'runtime': 'item_duration', 'userrating': 'item_rating', 'width': 'item_width', 'height':
'item_height', 'language': 'item_lang'}]

def searchForVideos(self, title, pagenumber):
"""Common name for a video search. Used to interface with MythTV plugin NetVision
Expand Down Expand Up @@ -1163,7 +1199,8 @@ def displayMovieData(data):
continue
if key == 'releasedate':
c = time.strptime(data[key],"%Y-%m-%d")
trailer_data[self.key_translation[1][key]] = time.strftime("%a, %d %b %Y 00:%M:%S GMT",c) # <pubDate>Tue, 14 Jul 2009 17:05:00 GMT</pubDate> <pubdate>Wed, 24 Jun 2009 03:53:00 GMT</pubdate>
# <pubDate>Tue, 14 Jul 2009 17:05:00 GMT</pubDate> <pubdate>Wed, 24 Jun 2009 03:53:00 GMT</pubdate>
trailer_data[self.key_translation[1][key]] = time.strftime("%a, %d %b %Y 00:%M:%S GMT",c)
continue
trailer_data[self.key_translation[1][key]] = data[key]
else:
Expand Down Expand Up @@ -1227,7 +1264,10 @@ def movieData(tmdb_id):
self.key_translation[1][self.thumbnails] = 'item_thumbnail'

# Channel details and search results
channel = {'channel_title': u'themoviedb.org', 'channel_link': u'http://themoviedb.org', 'channel_description': u'themoviedb.org is an open “wiki-style” movie database', 'channel_numresults': 0, 'channel_returned': self.page_limit, u'channel_startindex': 0}
channel = {\
'channel_title': u'themoviedb.org', 'channel_link': u'http://themoviedb.org',
'channel_description': u'themoviedb.org is an open “wiki-style” movie database',
'channel_numresults': 0, 'channel_returned': self.page_limit, u'channel_startindex': 0}

trailers = []
trailer_total = 0
Expand Down
10 changes: 6 additions & 4 deletions mythtv/libs/libmythdvdnav/dvdread/dvd_udf.c
Expand Up @@ -333,16 +333,17 @@ static int SetUDFCache(dvd_reader_t *device, UDFCacheType type,
static int Unicodedecode( uint8_t *data, int len, char *target )
{
int p = 1, i = 0;
int err = 0;

if( ( data[ 0 ] == 8 ) || ( data[ 0 ] == 16 ) ) do {
if( data[ 0 ] == 16 ) p++; /* Ignore MSB of unicode16 */
if( data[ 0 ] == 16 ) err |= data[p++]; /* character cannot be converted to 8bit, return error */
if( p < len ) {
target[ i++ ] = data[ p++ ];
}
} while( p < len );

target[ i ] = '\0';
return 0;
return !err;
}

static int UDFDescriptor( uint8_t *data, uint16_t *TagID )
Expand Down Expand Up @@ -494,8 +495,9 @@ static int UDFFileIdentifier( uint8_t *data, uint8_t *FileCharacteristics,
L_FI = GETN1(19);
UDFLongAD(&data[20], FileICB);
L_IU = GETN2(36);
if (L_FI) Unicodedecode(&data[38 + L_IU], L_FI, FileName);
else FileName[0] = '\0';
if (L_FI) {
if (!Unicodedecode(&data[38 + L_IU], L_FI, FileName)) FileName[0] = 0;
} else FileName[0] = '\0';
return 4 * ((38 + L_FI + L_IU + 3) / 4);
}

Expand Down
7 changes: 7 additions & 0 deletions mythtv/libs/libmythdvdnav/dvdread/ifo_read.c
Expand Up @@ -1191,6 +1191,13 @@ int ifoRead_VTS_PTT_SRPT(ifo_handle_t *ifofile) {
return 0;
}

if(vts_ptt_srpt->nr_of_srpts > info_length / sizeof(*data)) {
fprintf(stderr, "libdvdread: PTT search table too small.\n");
free(vts_ptt_srpt);
free(data);
ifofile->vts_ptt_srpt = 0;
return 0;
}
for(i = 0; i < vts_ptt_srpt->nr_of_srpts; i++) {
B2N_32(data[i]);
/* assert(data[i] + sizeof(ptt_info_t) <= vts_ptt_srpt->last_byte + 1);
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/DVDRingBuffer.cpp
Expand Up @@ -111,7 +111,7 @@ long long DVDRingBufferPriv::Seek(long long time)
if (m_parent)
ffrewSkip = m_parent->GetFFRewSkip();

if (ffrewSkip != 1 && time != 0)
if (ffrewSkip != 1 && ffrewSkip != 0 && time != 0)
{
QMap<uint, uint>::const_iterator it = m_seekSpeedMap.lowerBound(labs(time));
if (it == m_seekSpeedMap.end())
Expand All @@ -125,7 +125,7 @@ long long DVDRingBufferPriv::Seek(long long time)
else
{
m_seektime = (uint64_t)time;
dvdRet = dvdnav_absolute_time_search(m_dvdnav, m_seektime, 1);
dvdRet = dvdnav_absolute_time_search(m_dvdnav, m_seektime, 0);
}

VERBOSE(VB_PLAYBACK+VB_EXTRA,
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/decoderbase.cpp
Expand Up @@ -865,7 +865,7 @@ long long DecoderBase::DVDFindPosition(long long desiredFrame)
current_speed = (int)m_parent->GetNextPlaySpeed();
}

if (ffrewSkip == 1)
if (ffrewSkip == 1 || ffrewSkip == 0)
{
diffTime = (int)ceil((desiredFrame - framesPlayed) / fps);
desiredTimePos = ringBuffer->DVD()->GetCurrentTime() +
Expand Down Expand Up @@ -896,7 +896,7 @@ long long DecoderBase::BDFindPosition(long long desiredFrame)
current_speed = (int)m_parent->GetNextPlaySpeed();
}

if (ffrewSkip == 1)
if (ffrewSkip == 1 || ffrewSkip == 0)
{
diffTime = (int)ceil((desiredFrame - framesPlayed) / fps);
desiredTimePos = ringBuffer->BD()->GetCurrentTime() +
Expand Down
3 changes: 2 additions & 1 deletion mythtv/libs/libmythtv/mythplayer.cpp
Expand Up @@ -4081,7 +4081,8 @@ VideoFrame* MythPlayer::GetRawVideoFrame(long long frameNumber)
VERBOSE(VB_PLAYBACK, LOC + QString("Waited 100ms for video frame"));
}

return videoOutput->GetLastDecodedFrame();
videoOutput->StartDisplayingFrame();
return videoOutput->GetLastShownFrame();
}

QString MythPlayer::GetEncodingType(void) const
Expand Down
38 changes: 21 additions & 17 deletions mythtv/libs/libmythtv/osd.h
Expand Up @@ -9,23 +9,27 @@ using namespace std;
class MythDialogBox;
struct AVSubtitle;

#define OSD_DLG_VIDEOEXIT "OSD_VIDEO_EXIT"
#define OSD_DLG_MENU "OSD_MENU"
#define OSD_DLG_SLEEP "OSD_SLEEP"
#define OSD_DLG_IDLE "OSD_IDLE"
#define OSD_DLG_INFO "OSD_INFO"
#define OSD_DLG_EDITING "OSD_EDITING"
#define OSD_DLG_ASKALLOW "OSD_ASKALLOW"
#define OSD_DLG_EDITOR "OSD_EDITOR"
#define OSD_DLG_CUTPOINT "OSD_CUTPOINT"
#define OSD_DLG_DELETE "OSD_DELETE"
// Force subtitle/interactive screens to be drawn first (i.e. at the back) by
// prepending their identifiers with a low numeric (may not always work as
// QMap/QString ordering is based on unicode values)
#define OSD_WIN_TELETEXT "00_OSD_TELETEXT"
#define OSD_WIN_SUBTITLE "00_OSD_SUBTITLES"
// MHEG should cover subtitles
#define OSD_WIN_INTERACT "01_OSD_INTERACTIVE"
// Screen names are prepended with alphanumerics to force the correct ordering
// when displayed. This is slightly complicated by the default windows
// (e.g. osd_message) whose names are hard coded into existing themes.

// menu dialogs should always be on top
#define OSD_DLG_VIDEOEXIT "xx_OSD_VIDEO_EXIT"
#define OSD_DLG_MENU "xx_OSD_MENU"
#define OSD_DLG_SLEEP "xx_OSD_SLEEP"
#define OSD_DLG_IDLE "xx_OSD_IDLE"
#define OSD_DLG_INFO "xx_OSD_INFO"
#define OSD_DLG_EDITING "xx_OSD_EDITING"
#define OSD_DLG_ASKALLOW "xx_OSD_ASKALLOW"
#define OSD_DLG_EDITOR "xx_OSD_EDITOR"
#define OSD_DLG_CUTPOINT "xx_OSD_CUTPOINT"
#define OSD_DLG_DELETE "xx_OSD_DELETE"
#define OSD_DLG_CONFIRM "mythconfirmpopup"
// subtitles are always painted first
#define OSD_WIN_TELETEXT "aa_OSD_TELETEXT"
#define OSD_WIN_SUBTITLE "aa_OSD_SUBTITLES"
// MHEG and blu-ray overlay should cover subtitles
#define OSD_WIN_INTERACT "bb_OSD_INTERACTIVE"

#define kOSDFadeTime 1000

Expand Down
1 change: 1 addition & 0 deletions mythtv/libs/libmythui/mythrender_opengl.cpp
Expand Up @@ -8,6 +8,7 @@
#if defined(Q_WS_X11)
#include <QX11Info>
#include <GL/glx.h>
#include <GL/glu.h>
#endif

MYTH_GLXGETVIDEOSYNCSGIPROC MythRenderOpenGL::gMythGLXGetVideoSyncSGI = NULL;
Expand Down
7 changes: 4 additions & 3 deletions mythtv/programs/mythcommflag/PrePostRollFlagger.cpp
Expand Up @@ -394,10 +394,11 @@ void PrePostRollFlagger::GetCommercialBreakList(frm_dir_map_t &marks)
end = closestAfterPre;
else
end = closestBeforePre;
}else if(closestBeforePre)
}
else if(closestBeforePre)
end = closestBeforePre;
else if(closestAfterPre)
end = closestAfterPre;
end = closestAfterPre;
else
end = preRoll;

Expand All @@ -419,7 +420,7 @@ void PrePostRollFlagger::GetCommercialBreakList(frm_dir_map_t &marks)
else if(closestBeforePost)
start = closestBeforePost;
else if(closestAfterPost)
start = closestAfterPre;
start = closestAfterPost;
else if(postRoll)
start = myTotalFrames - postRoll;

Expand Down
2 changes: 1 addition & 1 deletion mythtv/programs/mythfrontend/networkcontrol.cpp
Expand Up @@ -416,7 +416,7 @@ void NetworkControlClient::readClient(void)
while (socket->canReadLine())
{
lineIn = socket->readLine();
lineIn.replace(QRegExp("[^-a-zA-Z0-9\\s\\.:_#/$%&()*+,;<=>?\\[\\]\\|]"), "");
lineIn.replace(QRegExp("[^-a-zA-Z0-9\\s\\.:_@#/$%&()*+,;<=>?\\[\\]\\|]"), "");
lineIn.replace(QRegExp("[\r\n]"), "");
lineIn.replace(QRegExp("^\\s"), "");

Expand Down

0 comments on commit 32952c9

Please sign in to comment.