diff options
author | Markos Chandras <hwoarang@gentoo.org> | 2011-08-14 13:11:31 +0000 |
---|---|---|
committer | Markos Chandras <hwoarang@gentoo.org> | 2011-08-14 13:11:31 +0000 |
commit | 51078a1a9f8b4b274f31f4e5b222bbbb80936fa0 (patch) | |
tree | d5a8dc6af1949fb5a4fc8824809a3d554a822d5b /media-video | |
parent | Bump to 2.0.1, for GNOME 3 (diff) | |
download | gentoo-2-51078a1a9f8b4b274f31f4e5b222bbbb80936fa0.tar.gz gentoo-2-51078a1a9f8b4b274f31f4e5b222bbbb80936fa0.tar.bz2 gentoo-2-51078a1a9f8b4b274f31f4e5b222bbbb80936fa0.zip |
add patch from upstream svn repository to fix youtube plugin
(Portage version: 2.2.0_alpha50/cvs/Linux x86_64)
Diffstat (limited to 'media-video')
3 files changed, 277 insertions, 1 deletions
diff --git a/media-video/xvideoservicethief/ChangeLog b/media-video/xvideoservicethief/ChangeLog index f7eb47525cdf..4ed0032ac083 100644 --- a/media-video/xvideoservicethief/ChangeLog +++ b/media-video/xvideoservicethief/ChangeLog @@ -1,6 +1,13 @@ # ChangeLog for media-video/xvideoservicethief # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/media-video/xvideoservicethief/ChangeLog,v 1.23 2011/05/01 21:30:39 hwoarang Exp $ +# $Header: /var/cvsroot/gentoo-x86/media-video/xvideoservicethief/ChangeLog,v 1.24 2011/08/14 13:11:31 hwoarang Exp $ + +*xvideoservicethief-2.4.1-r1 (14 Aug 2011) + + 14 Aug 2011; Markos Chandras <hwoarang@gentoo.org> + +xvideoservicethief-2.4.1-r1.ebuild, + +files/xvideoservicethief-2.4.1-youtube-api.patch: + add patch from upstream svn repository to fix youtube plugin 01 May 2011; Markos Chandras <hwoarang@gentoo.org> -xvideoservicethief-2.4.ebuild, xvideoservicethief-2.4.1.ebuild: diff --git a/media-video/xvideoservicethief/files/xvideoservicethief-2.4.1-youtube-api.patch b/media-video/xvideoservicethief/files/xvideoservicethief-2.4.1-youtube-api.patch new file mode 100644 index 000000000000..50f6bbe445d7 --- /dev/null +++ b/media-video/xvideoservicethief/files/xvideoservicethief-2.4.1-youtube-api.patch @@ -0,0 +1,188 @@ +--- resources/services/youtube/youtube.js 2010/09/02 11:52:07 911 ++++ resources/services/youtube/youtube.js 2011/08/06 23:30:28 961 +@@ -3,7 +3,7 @@ + * This file is part of xVideoServiceThief, + * an open-source cross-platform Video service download + * +-* Copyright (C) 2007 - 2010 Xesc & Technology ++* Copyright (C) 2007 - 2011 Xesc & Technology + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by +@@ -25,9 +25,9 @@ + + function RegistVideoService() + { +- this.version = "2.1.5"; ++ this.version = "3.0.1"; + this.minVersion = "2.0.0a"; +- this.author = "Xesc & Technology 2009"; ++ this.author = "Xesc & Technology 2011"; + this.website = "http://www.youtube.com/"; + this.ID = "youtube.com"; + this.caption = "YouTube"; +@@ -55,32 +55,103 @@ + // download webpage + var http = new Http(); + var html = http.downloadWebpage(youTubeURL); ++ // get cookies ++ result.cookies = http.getCookies("|"); + // get the video title + result.title = copyBetween(html, "<title>", "</title>"); + result.title = normalizeSpaces(result.title); ++ result.title = strReplace(result.title, "\n", ""); ++ result.title = strReplace(result.title, " - YouTube", ""); + // check if this video need a login +- result.needLogin = result.title == "Broadcast Yourself."; ++ result.needLogin = strIndexOf(html, "signing_in") != -1; + // if we can continue (no loggin needed) + if (result.needLogin) return result; +- // get the video info block +- var dirtyUrl = copyBetween(html, "fmt_stream_map=", "34%7Chttp"); +- // we have an empty "dirtyUrl"?? if yes then we give it a second try +- if (dirtyUrl == "") dirtyUrl = copyBetween(html, "fmt_url_map=", "&") + "&"; +- // get the video resolution +- var vidRes = getToken(dirtyUrl, "%7C", 0); +- // check if is a HD_VIDEO_RES (for HD videos the extension is mp4) +- if (vidRes == HD_VIDEO_RES) result.extension = ".mp4"; +- // get the video url +- result.URL = getToken(dirtyUrl, "%7C", 1); +- // convert the hex codes to ascii +- result.URL = cleanUrl(result.URL); +- // remove the last "," and replace it with an "&" (if is needed) +- if (strLastIndexOf(result.URL, "&") < strLastIndexOf(result.URL, ",")) +- result.URL = strRemove(result.URL, strLastIndexOf(result.URL, ","), result.URL.toString().length) + "&"; ++ // get the video URL and extension ++ var videoInfo = getVideoUrlAndExtension(html); ++ result.URL = videoInfo.url; ++ result.extension = videoInfo.extension; + // return the video information + return result; + } + ++function getVideoUrlAndExtension(html) ++{ ++ // init result ++ var result = { url:null, extension:null }; ++ // get the flashVars value ++ var flashVars = "?" + copyBetween(html, 'flashvars="', '"'); ++ // convert each "&" into "&" ++ flashVars = strReplace(flashVars, "&", "&"); ++ // get an array with all fmt_stream_map values ++ var fmt_stream_map_arr = splitString(getUrlParam(flashVars, "url_encoded_fmt_stream_map"), "url%3D", false); ++ // default selected video quality ++ var selectedFormat = -1; ++ // detect the better quality ++ for (var n = 0; n < fmt_stream_map_arr.length && selectedFormat == -1; n++) ++ { ++ fmt_stream_map_arr[n] = "?url=" + cleanUrl(fmt_stream_map_arr[n]).toString(); ++ // remove the last "," (if exists) ++ if (strLastIndexOf(fmt_stream_map_arr[n], ",") == fmt_stream_map_arr[n].toString().length - 1) ++ fmt_stream_map_arr[n] = strRemove(fmt_stream_map_arr[n], fmt_stream_map_arr[n].toString().length - 1, 1); ++ // check video type ++ var vtype = getToken(getUrlParam(fmt_stream_map_arr[n], "type"), ";", 0); ++ // is known format? ++ if (vtype == "video/x-flv" || vtype == "video/mp4") ++ { ++ selectedFormat = n; ++ // configure video extension ++ result.extension = extensionFromVideoType(vtype); ++ } ++ } ++ // no format selected? ++ if (selectedFormat == -1) selectedFormat = 0; ++ // get the host url ++ var urlHost = getToken(fmt_stream_map_arr[selectedFormat], "?", 1); ++ urlHost = strReplace(urlHost, "url=", ""); ++ // leave only the parameters ++ fmt_stream_map_arr[selectedFormat] = getToken(fmt_stream_map_arr[selectedFormat], "?", 2); ++ // get url parts ++ var urlParts = splitString(fmt_stream_map_arr[selectedFormat], "&", false); ++ // set the url host ++ result.url = urlHost + "?"; ++ // build the initial url ++ for (var n = 0; n < urlParts.length; n++) ++ { ++ var pname = getToken(urlParts[n], "=", 0).toString(); ++ var pvalue = getToken(urlParts[n], "=", 1).toString(); ++ var duplicatedPname = strIndexOf(result.url, pname + "=") != -1; ++ // is an excluded param? ++ if (!duplicatedPname && pname != "fexp" && pname != "quality" && pname != "fallback_host" && pname != "type") ++ result.url += pname + "=" + pvalue + "&"; ++ } ++ // remove the last & ++ if (strLastIndexOf(result.url, "&") == result.url.length - 1) ++ urlInitial = strRemove(result.url, result.url.length - 1, 1); ++ // get extra (optional) params ++ var ptchn = getUrlParam(flashVars, "ptchn"); ++ if (ptchn != "") result.url += "ptchn=" + ptchn + "&"; ++ var ptk = getUrlParam(flashVars, "ptk"); ++ if (ptk != "") result.url += "ptk=" + ptk; ++ // configure the video extension (if is not yet configured) ++ if (!result.extension) ++ { ++ var vtype = getToken(getUrlParam(fmt_stream_map_arr[selectedFormat], "type"), ";", 0); ++ // configure video extension ++ result.extension = extensionFromVideoType(vtype); ++ } ++ // return ++ return result; ++} ++ ++function extensionFromVideoType(vtype) ++{ ++ if (vtype == "video/x-flv") return ".flv"; ++ if (vtype == "video/mp4") return ".mp4"; ++ if (vtype == "video/webm") return ".webm"; ++ // default extension ++ return ".flv"; ++} ++ + /* + This function "normalizeSpaces(str)" will be deprecated on next xVST version + and replaced with the new "simplifyString(str)" function (added in xVST 2.3.1) +@@ -99,9 +170,11 @@ + function searchVideos(keyWord, pageIndex) + { + const URL_SEARCH = "http://www.youtube.com/results?search_query=%1&page=%2&hl=%3"; +- const HTML_SEARCH_START = "<!-- start search results -->"; +- const HTML_SEARCH_FINISH = "<!-- end search results -->"; +- const HTML_SEARCH_SEPARATOR = '<div class="video-entry">'; ++ const HTML_SEARCH_START = '<div id="search-results">'; ++ const HTML_SEARCH_FINISH = '<span id="search-pva-content">'; ++ const HTML_SEARCH_SEPARATOR = '<div class="result-item *sr ">'; ++ const HTML_SEARCH_SUMMARY_START = '<p class="num-results">'; ++ const HTML_SEARCH_SUMMARY_END = '</p>'; + // replace all spaces for "+" + keyWord = strReplace(keyWord, " ", "+"); + // init search results object +@@ -110,7 +183,7 @@ + var http = new Http(); + var html = http.downloadWebpage(strFormat(URL_SEARCH, keyWord, pageIndex, searchResults.getUserLanguage())); + // get the search summary +- var summary = copyBetween(html, '<div id="search-num-results" class="name">', '</div>'); ++ var summary = copyBetween(html, HTML_SEARCH_SUMMARY_START, HTML_SEARCH_SUMMARY_END); + searchResults.setSummary(cleanSummary(summary)); + // get results html block + var htmlResults = copyBetween(html, HTML_SEARCH_START, HTML_SEARCH_FINISH); +@@ -148,14 +221,17 @@ + var tmp, videoUrl, imageUrl, title, description, duration, rating; + // get video url + videoUrl = VIDEO_URL + copyBetween(html, 'href="', '"'); +- // get title and image url ++ // get image url + tmp = copyBetween(html, '<img', '>') ; +- title = copyBetween(tmp, 'title="', '"'); + imageUrl = copyBetween(tmp, 'src="', '"'); + if (strIndexOf(imageUrl, "default.jpg") == -1) // if is not a "default.jpg"... + imageUrl = copyBetween(tmp, 'thumb="', '"'); ++ imageUrl = "http:" + imageUrl; ++ // get video title ++ title = copyBetween(html, 'dir="ltr" title="', '"'); + // get video description +- description = copyBetween(html, 'class="video-description">', '</div>'); ++ description = copyBetween(html, '<p id="video-description-', '</p>'); ++ description = copyBetween(description + '|', '>', '|'); + // get video duration + duration = convertToSeconds(copyBetween(html, '<span class="video-time">', '</span>')); + // get rating diff --git a/media-video/xvideoservicethief/xvideoservicethief-2.4.1-r1.ebuild b/media-video/xvideoservicethief/xvideoservicethief-2.4.1-r1.ebuild new file mode 100644 index 000000000000..5e5857884d20 --- /dev/null +++ b/media-video/xvideoservicethief/xvideoservicethief-2.4.1-r1.ebuild @@ -0,0 +1,81 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/media-video/xvideoservicethief/xvideoservicethief-2.4.1-r1.ebuild,v 1.1 2011/08/14 13:11:31 hwoarang Exp $ + +EAPI=2 + +LANGS="br ca cs da de es fr gl hu it ja ko nl pl ro ru sv" + +inherit eutils qt4-r2 versionator + +MY_PV=$(replace_all_version_separators '_') +MY_P="xVST_${MY_PV}_src" + +DESCRIPTION="Download (and convert) videos from various Web Video Services" +HOMEPAGE="http://xviservicethief.sourceforge.net/" +SRC_URI="mirror://sourceforge/xviservicethief/${MY_P}.zip" + +LICENSE="GPL-3" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="debug doc" + +DEPEND="app-arch/unzip + >=x11-libs/qt-gui-4.5.3:4 + >=x11-libs/qt-webkit-4.5.3:4 + doc? ( app-doc/doxygen )" +RDEPEND=">=x11-libs/qt-gui-4.5.3:4 + virtual/ffmpeg + media-video/flvstreamer" + +RES_NAME="xVST" + +S="${WORKDIR}" + +src_prepare() { + # fix translations + mv "${S}"/resources/translations/${RES_NAME}_cz.ts \ + "${S}"/resources/translations/${RES_NAME}_cs.ts ||die + mv "${S}"/resources/translations/${RES_NAME}_jp.ts \ + "${S}"/resources/translations/${RES_NAME}_ja.ts || die + mv "${S}"/resources/translations/${RES_NAME}_du.ts \ + "${S}"/resources/translations/${RES_NAME}_nl.ts || die + mv "${S}"/resources/translations/${RES_NAME}_kr.ts \ + "${S}"/resources/translations/${RES_NAME}_ko.ts || die + # fix plugins, language path + sed -i -e "s/getApplicationPath()\ +\ \"/\"\/usr\/share\/${PN}/g" \ + "${S}"/src/options.cpp || die "failed to fix paths" + epatch "${FILESDIR}"/${P}-youtube-api.patch +} + +src_compile() { + local lang= + emake || die "emake failed" + for lang in "${S}"/resources/translations/*.ts; do + lrelease ${lang} + done +} + +src_install() { + dobin bin/xvst || die "dobin failed" + local dest=/usr/share/${PN}/plugins + dodir ${dest} + find resources/services -name '*.js' -exec cp -dpR {} "${D}"${dest} \; + newicon resources/images/InformationLogo.png xvst.png + make_desktop_entry /usr/bin/xvst xVideoServiceThief xvst 'Qt;AudioVideo;Video' + if use doc; then + cd "${S}/documentation/source" + sed -i "/OUTPUT_DIRECTORY/s:G\:.*:docs:" Doxyfile + doxygen Doxyfile + dohtml -r docs/html/* || die "dohtml failed" + fi + + #install translations + insinto /usr/share/${PN}/languages/ + local lang= tlang= + for lang in ${LINGUAS}; do + for tlang in ${LANGS}; do + [[ ${lang} == ${tlang} ]] && doins "${S}"/resources/translations/xVST_${tlang}.qm + done + done +} |