|
@@ -1,152 +1,60 @@
|
|
@inherits FnzComponentBase
|
|
@inherits FnzComponentBase
|
|
|
|
|
|
@code {
|
|
@code {
|
|
- [Parameter, Required] public KeyValuePair<Guid, string>? Playlist { get; set; }
|
|
|
|
- [Parameter, Required] public int ListItemIndex { get; set; }
|
|
|
|
- [Parameter, Required] public int ListItemCount { get; set; }
|
|
|
|
-
|
|
|
|
- [Parameter] public EventCallback<Guid> EditPlaylist { get; set; } = EventCallback<Guid>.Empty;
|
|
|
|
- [Parameter] public EventCallback<Guid> DeletePlaylist { get; set; } = EventCallback<Guid>.Empty;
|
|
|
|
-
|
|
|
|
- private bool IsExpand;
|
|
|
|
- private PlaylistExportDialog dlgExport;
|
|
|
|
|
|
+ [Parameter, Required] public Guid PlaylistId { get; set; }
|
|
|
|
+ [Parameter, Required] public int TrackCount { get; set; }
|
|
|
|
+ [Parameter, Required] public int TrackIndex { get; set; }
|
|
|
|
+ [Parameter, Required] public FeTrack Track { get; set; }
|
|
|
|
+ private DiscDialog dlgDisc;
|
|
}
|
|
}
|
|
|
|
|
|
-<div class="table-responsive">
|
|
|
|
- <table class="table w-100">
|
|
|
|
- <tbody>
|
|
|
|
- @if (Playlist != null)
|
|
|
|
- {
|
|
|
|
- var arr = PlaylistHelper[Playlist.Value.Key];
|
|
|
|
-
|
|
|
|
- <tr class="table-primary">
|
|
|
|
- <td style="width:0" @onclick="()=>{IsExpand=!IsExpand;}">
|
|
|
|
- <button type="button" class="btn btn-primary p-2">
|
|
|
|
- @if (IsExpand)
|
|
|
|
- {
|
|
|
|
- <i class="bi bi-dash-square"></i>
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- <i class="bi bi-plus-square"></i>
|
|
|
|
- }
|
|
|
|
- </button>
|
|
|
|
- </td>
|
|
|
|
- <td class="text-left w-100 align-middle" @onclick="()=>{IsExpand=!IsExpand;}" colspan="3">
|
|
|
|
- <div class="text-nowrap">@Playlist.Value.Value</div>
|
|
|
|
- <div class="text-nowrap text-muted">
|
|
|
|
- (@arr.Count)
|
|
|
|
- @arr.Sum(p=>DataSet.AllTracks.Where(q=>q.Path==p).Select(q=>q.Tag?.Duration??0).FirstOrDefault()).SecondToDur()
|
|
|
|
- @arr.Sum(p=>DataSet.AllTracks.Where(q=>q.Path==p).Select(q=>q.Tag?.Length??0).FirstOrDefault()).BytesToFileSize()
|
|
|
|
- </div>
|
|
|
|
- </td>
|
|
|
|
- <td>
|
|
|
|
- @if (ListItemCount > 1)
|
|
|
|
- {
|
|
|
|
- var isFirst = ListItemIndex == 0;
|
|
|
|
- var isLast = ListItemIndex == ListItemCount - 1;
|
|
|
|
-
|
|
|
|
- <div class="dropstart">
|
|
|
|
- <button type="button" class="btn btn-primary p-2" data-bs-toggle="dropdown">
|
|
|
|
- <i class="bi bi-arrow-down-up"></i>
|
|
|
|
- </button>
|
|
|
|
- <div class="dropdown-menu text-end p-1 text-nowrap" style="width: initial;min-width: initial;transform: translateY(-10);">
|
|
|
|
- <button class="btn btn-primary p-2" disabled="@isFirst" @onclick="()=>PlaylistHelper.ListMoveUp(ListItemIndex)">
|
|
|
|
- <i class="bi bi-arrow-bar-up"></i>
|
|
|
|
- Up
|
|
|
|
- </button>
|
|
|
|
- <button class="btn btn-primary p-2" disabled="@isLast" @onclick="()=>PlaylistHelper.ListMoveDown(ListItemIndex)">
|
|
|
|
- <i class="bi bi-arrow-bar-down"></i>
|
|
|
|
- Down
|
|
|
|
- </button>
|
|
|
|
- </div>
|
|
|
|
- </div>
|
|
|
|
- }
|
|
|
|
- </td>
|
|
|
|
- <td>
|
|
|
|
- <button type="button" class="btn btn-primary p-2" @onclick="()=>DownloadPlaylist(Playlist.Value.Key)">
|
|
|
|
- <i class="bi bi-download"></i>
|
|
|
|
- </button>
|
|
|
|
- </td>
|
|
|
|
- <td>
|
|
|
|
- <button type="button" class="btn btn-primary p-2" @onclick="()=>EditPlaylist.InvokeAsync(Playlist.Value.Key)">
|
|
|
|
- <i class="bi bi-pencil-square"></i>
|
|
|
|
- </button>
|
|
|
|
- </td>
|
|
|
|
- <td>
|
|
|
|
- <button type="button" class="btn btn-danger p-2" @onclick="()=>DeletePlaylist.InvokeAsync(Playlist.Value.Key)">
|
|
|
|
- <i class="bi bi-trash"></i>
|
|
|
|
- </button>
|
|
|
|
- </td>
|
|
|
|
- </tr>
|
|
|
|
-
|
|
|
|
- @if (IsExpand)
|
|
|
|
- {
|
|
|
|
- @foreach (var item in arr.KeepNoEmpty().WithIndex())
|
|
|
|
- {
|
|
|
|
- if (item.item != null)
|
|
|
|
- {
|
|
|
|
- var track = DataSet.AllTracks.FirstOrDefault(p => p.Path == item.item);
|
|
|
|
- if (track != null)
|
|
|
|
- {
|
|
|
|
- <PlaylistTableItemTrack Track="track" RemoveClick="()=>Remove(Playlist.Value.Key, item.index,item.item)"></PlaylistTableItemTrack>
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- var uri = new Uri(item.item);
|
|
|
|
- var paths = uri.AbsolutePath.Split('/').Skip(2).ToArray();
|
|
|
|
-
|
|
|
|
- <tr>
|
|
|
|
- <td><img src="blazor-192.png" style="height:50px" /></td>
|
|
|
|
- <td colspan="6" class="align-middle w-100">
|
|
|
|
- <div class="text-nowrap">- broken reference -</div>
|
|
|
|
- @foreach (var p in paths)
|
|
|
|
- {
|
|
|
|
- <span style="display:inline-block" class="text-nowrap text-muted border border-1 m-1 p-1 rounded">@Uri.UnescapeDataString(p)</span>
|
|
|
|
- }
|
|
|
|
- </td>
|
|
|
|
- <td>
|
|
|
|
- <div class="dropstart">
|
|
|
|
- <button type="button" class="btn btn-danger p-2" data-bs-toggle="dropdown">
|
|
|
|
- <i class="bi bi-folder-minus"></i>
|
|
|
|
- </button>
|
|
|
|
- <ul class="dropdown-menu mx-2">
|
|
|
|
- <li><button class="dropdown-item text-danger" @onclick="()=>Remove(Playlist.Value.Key, item.index,item.item)">Confirm Remove</button></li>
|
|
|
|
- </ul>
|
|
|
|
- </div>
|
|
|
|
- </td>
|
|
|
|
- </tr>
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- else
|
|
|
|
- {
|
|
|
|
- <tr>
|
|
|
|
- <td></td>
|
|
|
|
- <td colspan="7" class="align-middle w-100">
|
|
|
|
- <div class="text-nowrap">- empty -</div>
|
|
|
|
- </td>
|
|
|
|
- </tr>
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- </tbody>
|
|
|
|
- </table>
|
|
|
|
-</div>
|
|
|
|
-
|
|
|
|
-<PlaylistExportDialog @ref="dlgExport">
|
|
|
|
-</PlaylistExportDialog>
|
|
|
|
-
|
|
|
|
-@code {
|
|
|
|
- private void DownloadPlaylist(Guid playlistId)
|
|
|
|
- {
|
|
|
|
- dlgExport.Show(playlistId);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void Remove(Guid playlistId, int index, string path)
|
|
|
|
- {
|
|
|
|
- PlaylistHelper.DeleteTrackInPlaylist(playlistId, index, path);
|
|
|
|
- StateHasChanged();
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+<tr class="mouse-hilight">
|
|
|
|
+ <td colspan="2" style="width:0">
|
|
|
|
+ <img src="@Track.Disc.CoverPath" style="height:50px" @onclick="()=>dlgDisc.Show(Track.Disc)" />
|
|
|
|
+ <DiscDialog @ref="dlgDisc"></DiscDialog>
|
|
|
|
+ </td>
|
|
|
|
+ <td class="align-middle" style="width:250px">
|
|
|
|
+ <FileIcon Track="@Track" ShowParam="true"></FileIcon>
|
|
|
|
+ </td>
|
|
|
|
+ <td class="align-middle w-100">
|
|
|
|
+ <div class="text-nowrap">@Track.GetTitleOrFilename()</div>
|
|
|
|
+ <div class="text-nowrap text-muted"> @Track.Tag?.Artist</div>
|
|
|
|
+ </td>
|
|
|
|
+ <td>
|
|
|
|
+ @if (TrackCount > 1)
|
|
|
|
+ {
|
|
|
|
+ var isFirst = TrackIndex == 0;
|
|
|
|
+ var isLast = TrackIndex == TrackCount - 1;
|
|
|
|
+
|
|
|
|
+ <div class="dropstart">
|
|
|
|
+ <button type="button" class="btn btn-primary p-2" data-bs-toggle="dropdown">
|
|
|
|
+ <i class="bi bi-arrow-down-up"></i>
|
|
|
|
+ </button>
|
|
|
|
+ <div class="dropdown-menu text-end p-1 text-nowrap" style="width: initial;min-width: initial;">
|
|
|
|
+ <button class="btn btn-primary p-2" disabled="@isFirst" @onclick="()=>PlaylistHelper.TrackMoveUp(PlaylistId,TrackIndex)">
|
|
|
|
+ <i class="bi bi-arrow-bar-up"></i>
|
|
|
|
+ Up
|
|
|
|
+ </button>
|
|
|
|
+ <button class="btn btn-primary p-2" disabled="@isLast" @onclick="()=>PlaylistHelper.TrackMoveDown(PlaylistId,TrackIndex)">
|
|
|
|
+ <i class="bi bi-arrow-bar-down"></i>
|
|
|
|
+ Down
|
|
|
|
+ </button>
|
|
|
|
+ </div>
|
|
|
|
+ </div>
|
|
|
|
+ }
|
|
|
|
+ </td>
|
|
|
|
+ <td class="text-center" colspan="2">
|
|
|
|
+ <div class="text-nowrap">@Track.Tag?.Duration.SecondToDur()</div>
|
|
|
|
+ <div class="text-nowrap text-muted"> @Track.Tag?.Length.BytesToFileSize()</div>
|
|
|
|
+ </td>
|
|
|
|
+ <td>
|
|
|
|
+ <div class="dropstart">
|
|
|
|
+ <button type="button" class="btn btn-danger p-2" data-bs-toggle="dropdown">
|
|
|
|
+ <i class="bi bi-folder-minus"></i>
|
|
|
|
+ </button>
|
|
|
|
+ <ul class="dropdown-menu mx-2">
|
|
|
|
+ <li><button class="dropdown-item text-danger" @onclick="()=>PlaylistHelper.RemoveTrackInPlaylist(PlaylistId,TrackIndex,Track.Path)">Confirm Remove</button></li>
|
|
|
|
+ </ul>
|
|
|
|
+ </div>
|
|
|
|
+ </td>
|
|
|
|
+</tr>
|