Skip to content

Commit

Permalink
unpublishublisheded commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sir-kain committed Feb 14, 2021
1 parent 6e5debf commit 88507f8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@
},
{
"command": "vsmp.viewTrackDetail",
"when": "view == vsmp.mediaList",
"when": "view == vsmp.mediaList && viewItem == track",
"group": "inline"
}
]
Expand Down
21 changes: 1 addition & 20 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,26 +136,7 @@ watchFile(config.favFile, async (curr, prev) => {
});

function updateTreeView(view: string, tracks: string[]) {
window.registerTreeDataProvider(view, {
getChildren() {
return tracks;
},
getTreeItem(url: string) {
let title = url.split("/").pop();
return {
// tooltip: `: ${track.title}`,
label: title,
// iconPath: track.icon ? Uri.parse(track.icon) : '',
command: {
command: "vsmp.play",
title: 'play',
arguments: [
url
]
}
};
}
});
window.registerTreeDataProvider(view, new SearchList(undefined, undefined, tracks));
}

function updateSearchTreeView(view: string, provider: string, keyword: string) {
Expand Down
22 changes: 20 additions & 2 deletions src/views/searchList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ import { Commands } from '../data/constants';

export class SearchList implements vscode.TreeDataProvider<TrackItem | ChannelItem> {

constructor(private provider: string, private keyword: string) { }
constructor(private provider?: string, private keyword?: string, private file?: string[]) { }

getTreeItem(element: TrackItem | ChannelItem): vscode.TreeItem {
return element;
}

async getChildren(element: any): Promise<TrackItem[] | ChannelItem[]> {
if (!this.provider || !this.keyword) {
console.log('element ==>', element);
return Promise.resolve([]);
}
if (element && element.channel) {
const items = new ChannelItem(element.channel, this.provider)
return Promise.resolve([items]);
Expand Down Expand Up @@ -58,7 +62,7 @@ export class TrackItem extends vscode.TreeItem {

iconPath = this.thumbnail ? vscode.Uri.parse(this.thumbnail) : '';

contextValue = 'track';
contextValue = 'search';
}

export class ChannelItem extends vscode.TreeItem {
Expand All @@ -79,3 +83,17 @@ export class ChannelItem extends vscode.TreeItem {

contextValue = 'channel';
}

export class UrlItem extends vscode.TreeItem {

constructor(
public readonly label: string,
public readonly command: vscode.Command,
) {
super(label, vscode.TreeItemCollapsibleState.None);
}

// iconPath = path.join(__filename, '..', '..', '..', 'assets', `${this.provider.toLowerCase()}.png`);

contextValue = 'url';
}

0 comments on commit 88507f8

Please sign in to comment.