Ticket #4990: mythnews_podcast_patch.patch
File mythnews_podcast_patch.patch, 3.7 KB (added by , 17 years ago) |
---|
-
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 if(cmdURL.contains("youtube.com")) 959 { 960 filename = QRegExp::escape(article->title()); 961 } else { 962 QStringList qstr = QStringList::split("/", cmdURL); 963 for ( QStringList::Iterator it = qstr.begin(); it != qstr.end(); ++it ) { 964 filename = QRegExp::escape(*it); 965 } 966 } 956 967 957 if (getHttpFile(sFilename, cmdURL)) 958 { 959 qApp->unlock(); 960 playVideo(sFilename); 961 qApp->lock(); 962 } 968 filename.replace(" ","_"); 969 filename.replace("/","-"); // As per above, this ensures that there aren't any conflicts with linux file name formats 970 971 QFile file(fileprefix + "/" + filename); 972 QString sFilename(fileprefix + "/" + filename); 973 974 if(!file.exists()) 975 { 976 dir = QDir(fileprefix); 977 if (!dir.exists()) 978 dir.mkdir(fileprefix); 979 980 981 cout << sFilename << endl; 982 983 if (getHttpFile(sFilename, cmdURL)) 984 { 985 qApp->unlock(); 986 playVideo(QRegExp::escape(sFilename)); 987 qApp->lock(); 988 } 989 } else { 990 qApp->unlock(); 991 playVideo(QRegExp::escape(sFilename)); 992 qApp->lock(); 993 } 994 995 963 996 } else { 964 997 QString cmdUrl(article->articleURL()); 965 998 cmdUrl.replace('\'', "%27"); … … 1207 1240 } 1208 1241 else 1209 1242 { 1243 /* This bit is causing me issues. Video and flash works fine, however audio files cause myth to lose the focus 1244 and the external player is launched but doesn't have the focus, so key presses aren't being passed on. 1245 */ 1210 1246 if (command_string.contains("%s")) 1247 //command_string = "mplayer "+filename; 1211 1248 command_string = command_string.replace(QRegExp("%s"), filename); 1212 1249 1250 cout << command_string << endl; 1213 1251 myth_system(command_string); 1214 1252 } 1215 1253 -
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) -
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