Ticket #4990: mythnews_patch.patch
File mythnews_patch.patch, 3.8 KB (added by , 16 years ago) |
---|
-
mythplugins/mythnews/mythnews/mythnews.cpp
946 946 if (!dir.exists()) 947 947 dir.mkdir(fileprefix); 948 948 949 fileprefix += "/MythNews"; 949 // Grabs the parent Site name and appends it to the fileprefix 950 950 951 dir = QDir(fileprefix); 952 if (!dir.exists()) 953 dir.mkdir(fileprefix); 951 fileprefix += "/MythNews/files/"; 952 fileprefix += article->parent(); 953 fileprefix.replace(" ", "_"); 954 955 // Some seriously dodgy code to grab the file name of the media file to be downloaded 956 QString filename; 954 957 955 QString sFilename(fileprefix + "/newstempfile"); 958 filename = QRegExp::escape(article->title()); 959 /* QStringList qstr = QStringList::split("/", cmdURL); 960 for ( QStringList::Iterator it = qstr.begin(); it != qstr.end(); ++it ) { 961 filename = QRegExp::escape(*it); 962 } */ 956 963 957 if (getHttpFile(sFilename, cmdURL)) 958 { 959 qApp->unlock(); 960 playVideo(sFilename); 961 qApp->lock(); 962 } 964 filename.replace(" ","_"); 965 filename.replace("/","-"); // As per above, this ensures that there aren't any conflicts with linux file name formats 966 967 QFile file(fileprefix + "/" + filename); 968 QString sFilename(fileprefix + "/" + filename); 969 970 if(!file.exists()) 971 { 972 dir = QDir(fileprefix); 973 if (!dir.exists()) 974 dir.mkdir(fileprefix); 975 976 977 cout << sFilename << endl; 978 979 if (getHttpFile(sFilename, cmdURL)) 980 { 981 qApp->unlock(); 982 playVideo(QRegExp::escape(sFilename)); 983 qApp->lock(); 984 } 985 } else { 986 qApp->unlock(); 987 playVideo(QRegExp::escape(sFilename)); 988 qApp->lock(); 989 } 990 991 963 992 } else { 964 993 QString cmdUrl(article->articleURL()); 965 994 cmdUrl.replace('\'', "%27"); … … 1207 1236 } 1208 1237 else 1209 1238 { 1239 /* This bit is causing me issues. Video and flash works fine, however audio files cause myth to lose the focus 1240 and the external player is launched but doesn't have the focus, so key presses aren't being passed on. 1241 */ 1210 1242 if (command_string.contains("%s")) 1243 //command_string = "mplayer "+filename; 1211 1244 command_string = command_string.replace(QRegExp("%s"), filename); 1212 1245 1246 cout << command_string << endl; 1213 1247 myth_system(command_string); 1214 1248 } 1215 1249 -
mythplugins/mythnews/mythnews/newsengine.cpp
55 55 56 56 } 57 57 58 const QString& NewsArticle::parent() 59 { 60 //Added this function to allow for media downloads 61 62 return m_parent->name(); 63 } 64 65 58 66 NewsSite::NewsSite(const QString& name, 59 67 const QString& url, 60 68 const QDateTime& updated) -
mythplugins/mythnews/mythnews/newsengine.h
52 52 const QString& thumbnail() const { return m_thumbnail; } 53 53 const QString& mediaURL() const { return m_mediaURL; } 54 54 const QString& enclosure() const { return m_enclosure; } 55 const QString& parent(); 56 const QString& type() const {return m_enclosureType; } 55 57 56 58 private: 57 59