mirror of
https://github.com/zoriya/Opus.git
synced 2025-12-06 06:26:15 +00:00
Adding open channels features where possible.
This commit is contained in:
@@ -358,7 +358,10 @@ namespace Opus.Api
|
||||
{
|
||||
if (ytItem.Snippet.Title != "[Deleted video]" && ytItem.Snippet.Title != "Private video" && ytItem.Snippet.Title != "Deleted video" && !MusicPlayer.queue.Exists(x => x.YoutubeID == ytItem.ContentDetails.VideoId))
|
||||
{
|
||||
Song song = new Song(System.Net.WebUtility.HtmlDecode(ytItem.Snippet.Title), ytItem.Snippet.ChannelTitle, ytItem.Snippet.Thumbnails.High.Url, ytItem.ContentDetails.VideoId, -1, -1, ytItem.ContentDetails.VideoId, true, false);
|
||||
Song song = new Song(WebUtility.HtmlDecode(ytItem.Snippet.Title), ytItem.Snippet.ChannelTitle, ytItem.Snippet.Thumbnails.High.Url, ytItem.ContentDetails.VideoId, -1, -1, ytItem.ContentDetails.VideoId, true, false)
|
||||
{
|
||||
ChannelID = ytItem.Snippet.ChannelId
|
||||
};
|
||||
tracks.Add(song);
|
||||
}
|
||||
}
|
||||
@@ -413,7 +416,10 @@ namespace Opus.Api
|
||||
|
||||
foreach (var video in searchReponse.Items)
|
||||
{
|
||||
Song song = new Song(WebUtility.HtmlDecode(video.Snippet.Title), video.Snippet.ChannelTitle, video.Snippet.Thumbnails.High.Url, video.Id.VideoId, -1, -1, null, true, false);
|
||||
Song song = new Song(WebUtility.HtmlDecode(video.Snippet.Title), video.Snippet.ChannelTitle, video.Snippet.Thumbnails.High.Url, video.Id.VideoId, -1, -1, null, true, false)
|
||||
{
|
||||
ChannelID = video.Snippet.ChannelId
|
||||
};
|
||||
songs.Add(song);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,11 +27,11 @@ namespace Opus.DataStructure
|
||||
public string Path { get; set; }
|
||||
public bool? IsParsed { get; set; }
|
||||
public bool IsYt { get; set; }
|
||||
public string ChannelID { get; set; }
|
||||
public DateTimeOffset? ExpireDate { get; set;}
|
||||
public int Duration { get; set; }
|
||||
public bool IsLiveStream = false;
|
||||
public string TrackID;
|
||||
public string channelID;
|
||||
|
||||
public Song() { }
|
||||
|
||||
@@ -60,9 +60,9 @@ namespace Opus.DataStructure
|
||||
int albumID = cursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Album);
|
||||
int thisID = cursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Id);
|
||||
int pathID = cursor.GetColumnIndex(MediaStore.Audio.Media.InterfaceConsts.Data);
|
||||
int playOrderID = cursor.GetColumnIndex(MediaStore.Audio.Playlists.Members.PlayOrder);
|
||||
//int playOrderID = cursor.GetColumnIndex(MediaStore.Audio.Playlists.Members.PlayOrder);
|
||||
|
||||
string playOrder = PlaylistTracks.instance != null ? cursor.GetString(playOrderID) : null;
|
||||
//string playOrder = PlaylistTracks.instance != null ? cursor.GetString(playOrderID) : null;
|
||||
string Artist = cursor.GetString(artistID);
|
||||
string Title = cursor.GetString(titleID);
|
||||
string Album = cursor.GetString(albumID);
|
||||
@@ -77,7 +77,7 @@ namespace Opus.DataStructure
|
||||
if (Album == null)
|
||||
Album = "Unknow Album";
|
||||
|
||||
return new Song(Title, playOrder ?? Artist, Album, null, AlbumArt, id, path);
|
||||
return new Song(Title, /*playOrder ?? */Artist, Album, null, AlbumArt, id, path);
|
||||
}
|
||||
|
||||
public static explicit operator Song(YoutubeExplode.Models.Video video)
|
||||
|
||||
@@ -210,6 +210,15 @@ namespace Opus.Adapter
|
||||
bottomSheet.Dismiss();
|
||||
})
|
||||
});
|
||||
|
||||
if(item.ChannelID != null)
|
||||
{
|
||||
actions.Add(new BottomSheetAction(Resource.Drawable.account, MainActivity.instance.Resources.GetString(Resource.String.goto_channel), (sender, eventArg) =>
|
||||
{
|
||||
ChannelManager.OpenChannelTab(item.ChannelID);
|
||||
bottomSheet.Dismiss();
|
||||
}));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -289,6 +298,15 @@ namespace Opus.Adapter
|
||||
bottomSheet.Dismiss();
|
||||
})
|
||||
});
|
||||
|
||||
if (item.ChannelID != null)
|
||||
{
|
||||
actions.Add(new BottomSheetAction(Resource.Drawable.account, MainActivity.instance.Resources.GetString(Resource.String.goto_channel), (sender, eventArg) =>
|
||||
{
|
||||
ChannelManager.OpenChannelTab(item.ChannelID);
|
||||
bottomSheet.Dismiss();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
bottomSheet.FindViewById<ListView>(Resource.Id.bsItems).Adapter = new BottomSheetAdapter(MainActivity.instance, Resource.Layout.BottomSheetText, actions);
|
||||
|
||||
@@ -312,7 +312,8 @@ namespace Opus.Fragments
|
||||
{
|
||||
Song song = new Song(item.Snippet.Title, item.Snippet.ChannelTitle, item.Snippet.Thumbnails.High.Url, item.ContentDetails.VideoId, -1, -1, item.ContentDetails.VideoId, true, false)
|
||||
{
|
||||
TrackID = item.Id
|
||||
TrackID = item.Id,
|
||||
ChannelID = item.Snippet.ChannelId
|
||||
};
|
||||
tracks.Add(song);
|
||||
}
|
||||
@@ -401,7 +402,8 @@ namespace Opus.Fragments
|
||||
{
|
||||
Song song = new Song(item.Snippet.Title, item.Snippet.ChannelTitle, item.Snippet.Thumbnails.Default__.Url, item.ContentDetails.VideoId, -1, -1, item.ContentDetails.VideoId, true, false)
|
||||
{
|
||||
TrackID = item.Id
|
||||
TrackID = item.Id,
|
||||
ChannelID = item.Snippet.ChannelId
|
||||
};
|
||||
adapter.tracks.Add(song);
|
||||
}
|
||||
@@ -532,6 +534,15 @@ namespace Opus.Fragments
|
||||
bottomSheet.Dismiss();
|
||||
})
|
||||
});
|
||||
|
||||
if (song.ChannelID != null)
|
||||
{
|
||||
actions.Add(new BottomSheetAction(Resource.Drawable.account, Resources.GetString(Resource.String.goto_channel), (sender, eventArg) =>
|
||||
{
|
||||
ChannelManager.OpenChannelTab(song.ChannelID);
|
||||
bottomSheet.Dismiss();
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
bottomSheet.FindViewById<ListView>(Resource.Id.bsItems).Adapter = new BottomSheetAdapter(MainActivity.instance, Resource.Layout.BottomSheetText, actions);
|
||||
|
||||
@@ -146,8 +146,6 @@ public class Queue : Fragment, RecyclerView.IOnItemTouchListener, PopupMenu.IOnM
|
||||
|
||||
private void ListView_ItemClick(object sender, int Position)
|
||||
{
|
||||
Song item = MusicPlayer.queue[Position];
|
||||
|
||||
if (Position == MusicPlayer.CurrentID())
|
||||
{
|
||||
Intent intent = new Intent(Activity, typeof(MusicPlayer));
|
||||
@@ -213,6 +211,15 @@ public class Queue : Fragment, RecyclerView.IOnItemTouchListener, PopupMenu.IOnM
|
||||
bottomSheet.Dismiss();
|
||||
})
|
||||
});
|
||||
|
||||
if (item.ChannelID != null)
|
||||
{
|
||||
actions.Add(new BottomSheetAction(Resource.Drawable.account, Resources.GetString(Resource.String.goto_channel), (sender, eventArg) =>
|
||||
{
|
||||
ChannelManager.OpenChannelTab(item.ChannelID);
|
||||
bottomSheet.Dismiss();
|
||||
}));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -307,7 +307,7 @@ namespace Opus.Fragments
|
||||
case "youtube#video":
|
||||
Song videoInfo = new Song(System.Net.WebUtility.HtmlDecode(result.Snippet.Title), result.Snippet.ChannelTitle, result.Snippet.Thumbnails.High.Url, result.Id.VideoId, -1, -1, null, true, false)
|
||||
{
|
||||
channelID = result.Snippet.ChannelId
|
||||
ChannelID = result.Snippet.ChannelId
|
||||
};
|
||||
if (result.Snippet.LiveBroadcastContent == "live")
|
||||
videoInfo.IsLiveStream = true;
|
||||
@@ -413,7 +413,7 @@ namespace Opus.Fragments
|
||||
MainActivity.instance.menu.FindItem(Resource.Id.search).CollapseActionView();
|
||||
MainActivity.instance.menu.FindItem(Resource.Id.search).ActionView.Focusable = true;
|
||||
MainActivity.instance.FindViewById<TabLayout>(Resource.Id.tabs).Visibility = ViewStates.Gone;
|
||||
ChannelManager.OpenChannelTab(item.channelID);
|
||||
ChannelManager.OpenChannelTab(item.ChannelID);
|
||||
bottomSheet.Dismiss();
|
||||
})
|
||||
});
|
||||
|
||||
@@ -448,6 +448,15 @@ namespace Opus
|
||||
bottomSheet.Dismiss();
|
||||
})
|
||||
});
|
||||
|
||||
if (item.ChannelID != null)
|
||||
{
|
||||
actions.Add(new BottomSheetAction(Resource.Drawable.account, Resources.GetString(Resource.String.goto_channel), (sender, eventArg) =>
|
||||
{
|
||||
ChannelManager.OpenChannelTab(item.ChannelID);
|
||||
bottomSheet.Dismiss();
|
||||
}));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -319,8 +319,8 @@
|
||||
<Reference Include="Xamarin.GooglePlayServices.Tasks, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Xamarin.GooglePlayServices.Tasks.70.1501.0-preview2\lib\MonoAndroid80\Xamarin.GooglePlayServices.Tasks.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="YoutubeExplode, Version=4.7.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\YoutubeExplode.4.7.3\lib\netstandard2.0\YoutubeExplode.dll</HintPath>
|
||||
<Reference Include="YoutubeExplode, Version=4.7.4.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\YoutubeExplode.4.7.4\lib\netstandard2.0\YoutubeExplode.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -125,5 +125,5 @@
|
||||
<package id="Xamarin.GooglePlayServices.Cast.Framework" version="70.1501.0-preview2" targetFramework="monoandroid81" />
|
||||
<package id="Xamarin.GooglePlayServices.Flags" version="70.1501.0-preview2" targetFramework="monoandroid81" />
|
||||
<package id="Xamarin.GooglePlayServices.Tasks" version="70.1501.0-preview2" targetFramework="monoandroid81" />
|
||||
<package id="YoutubeExplode" version="4.7.3" targetFramework="monoandroid90" />
|
||||
<package id="YoutubeExplode" version="4.7.4" targetFramework="monoandroid90" />
|
||||
</packages>
|
||||
Reference in New Issue
Block a user