fixed another livestream related issue

This commit is contained in:
Christian Schabesberger 2016-03-11 15:43:50 +01:00
parent 23a9061871
commit 4058ec2ee9
3 changed files with 23 additions and 5 deletions

View file

@ -1,7 +1,5 @@
package org.schabi.newpipe; package org.schabi.newpipe;
import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -33,7 +31,7 @@ import com.nostra13.universalimageloader.core.ImageLoader;
* along with NewPipe. If not, see <http://www.gnu.org/licenses/>. * along with NewPipe. If not, see <http://www.gnu.org/licenses/>.
*/ */
class VideoInfoItemViewCreator { public class VideoInfoItemViewCreator {
private final LayoutInflater inflater; private final LayoutInflater inflater;
private ImageLoader imageLoader = ImageLoader.getInstance(); private ImageLoader imageLoader = ImageLoader.getInstance();
private DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder().cacheInMemory(true).build(); private DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder().cacheInMemory(true).build();

View file

@ -220,7 +220,7 @@ public class YoutubeSearchEngine extends SearchEngine {
// -1 for no duration // -1 for no duration
return -1; return -1;
} else { } else {
throw new ParsingException("Could not get Duration", e); throw new ParsingException("Could not get Duration: " + getTitle(), e);
} }
@ -263,7 +263,7 @@ public class YoutubeSearchEngine extends SearchEngine {
return -1; return -1;
} else { } else {
throw new ParsingException( throw new ParsingException(
"Could not parse yt-lockup-meta although available", e); "Could not parse yt-lockup-meta although available: " + getTitle(), e);
} }
} }
@ -305,6 +305,14 @@ public class YoutubeSearchEngine extends SearchEngine {
private boolean isLiveStream(Element item) { private boolean isLiveStream(Element item) {
Element bla = item.select("span[class*=\"yt-badge-live\"]").first(); Element bla = item.select("span[class*=\"yt-badge-live\"]").first();
if(bla == null) {
// sometimes livestreams dont have badges but sill are live streams
// if video time is not available we most likly have an offline livestream
if(item.select("span[class*=\"video-time\"]").first() == null) {
return true;
}
}
return bla != null; return bla != null;
} }
}; };

View file

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>