China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-25 10:41
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Share] Online Music Player View 2,778 Replies 15
Original Poster Posted 2010-11-14 03:28 ·  中国 北京 联通
高级用户
★★★
据说是李先生
Credits 609
Posts 400
Joined 2008-04-23 15:55
18-year member
UID 116706
Gender Male
Status Offline
This Windows script (in WSF format) is what I use in CMD to listen to music online. The resource search service is provided by Google Music (actually it's piracy...), and the obtained music and lyrics resources seem to be provided by Juqing Music, with good quality. The most important thing is that I found the link speed is extremely fast!!!

Imagine opening a dark window and typing commands. To outsiders, it's already a very cool behavior. And you just type "Zhiziao also fell asleep" and hear the computer start playing Fish Leong's "Ningxia". The dark window even displays the lyrics along with the music, which is even cooler! Actually, it also supports downloading lyrics and songs simultaneously, which is simply all-round.

You can directly double-click it to run with the default wscript.exe, but this doesn't accept any parameters. It can only be run in the way I specified: played with wmplayer, which can only keep the lyrics;
While running with cscript.exe in the console is different. You can set parameters by yourself, provide lyrics display, and there are instructions and examples for the parameters. Take a good look. This is the situation I use most often:

Microsoft Windows XP
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\Ching Chum>cd desktop

C:\Documents and Settings\Ching Chum\Desktop>cscript -nologo gMusic.wsf /p 花椰
菜之歌
http://audio9.top100.cn/201011140218/2F4A554E5C6C3CCCB9D5B83B5E21AECA/streaming
/Special_332050/M0332050001.mp3
http://lyric.top100.cn/Special_332050/M0332050001.lrc
花椰菜之歌
八十八颗芭乐籽
肆十肆只石狮子
275.0
************ 开 始 播 放 ************

摇滚乐【Rock'n'Roll】

不会放弃猴子 许多人的梦啊
梦中的那只猴子 正在练吉他
他点了点头 看着天空
蓝色和白色是今天的颜色


晚餐吃咖哩 是我的主意
但我不吃花椰菜 真是挑剔
如果能够再重来一次 世界从此改变
我会选择吃拉面 男人的口味
PLAY → 01:48 128kbps



Some additional instructions:
1. If downloading is specified while playing, it may increase the buffering time for playback. Of course, if your internet speed is good, just ignore what I said;
2. There are a total of four switches for this thing. You can use all, none, or part of them. I specially put the lyrics in the error channel. If you understand the command line, you know how to get pure lyrics without playing or downloading;
3. I personally like music very much and also support copyright. I have bought many CDs. Although this is online, it's not easy for Juqing Music to do free copyright, please don't use part of the content in this script for hotlinking or commercial behavior;
4. If you are interested in learning VBS or JS scripts, you can take a look at the source code. Basically, there are common operations on the network, which are very typical examples.


Attachment: Usage instructions

【Google Music Console】 (C)2010 Mr.Ching 『据说是李先生』
Copyright? music.Google.cn & Top100.cn

Usage: gMusic.wsf Song

Options:

Song : Relevant key words about song information, such as song title, singer, album, lyrics, etc.
p : Command line to play music, dynamic variables can be used.
If there is no command, the script plays by itself.
d : Command line to download song, dynamic variables can be used.
If there is no command, the script calls to download by itself.
s : Indicate to list all search results for selection, otherwise automatically select the first result.
If the input serial number is within the listed range, select that item and continue;
If the input serial number is less than zero, give up and exit the script;
If the input serial number is zero, turn the page and re-select;
Otherwise, re-enter is required.
l : Indicate to output lyrics in channel two (error output).

Note:
When running with wscript.exe, no parameters are accepted.
Dynamic variables refer to some specific strings used to replace the relevant information of the current song. They are:
<N> Song title
<AR> Artist
<AL> Album
<T> Total length of song in seconds
<FMT> File extension
<URL> Song link URL
<LRC> Lyrics link URL
<QT> A double quote (")

Examples:
wscript gMusic.wsf
cscript gMusic.wsf "梁祝 俞丽拿" /d:"curl <URL> -o <QT><N> - <AR>.<FMT><QT>"
cscript gMusic.wsf "because of you" /p:"wmplayer <URL>" /s /l 2>temp.txt
cscript gMusic.wsf "Dear Friend - 顺子" /d /p
cscript gMusic.wsf /p 吃一碗热腾腾的炸酱面


-------2010.11.16 Attachment modification----------
1. Corrected an order error.
2. Added a lot of comments, and attached a pdf file for easy viewing.


[ Last edited by qinchun36 on 2010-11-16 at 13:35 ]
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
netbenton +11 2010-12-07 07:19
plp626 +15 2010-12-07 19:24
Attachments
gMusic.wsf.zip (8.64 KiB, Downloads: 44)
gMusic.pdf.zip (370.96 KiB, Downloads: 124)
Floor 2 Posted 2010-11-14 08:20 ·  中国 广东 东莞 电信
银牌会员
★★★
批处理编程迷
Credits 1,916
Posts 752
Joined 2008-12-28 04:30
17-year member
UID 135147
Gender Male
From 广西
Status Offline
I tried it and it didn't work. The error messages are as follows:

gMusic.wsf(0, 1) Windows Script Host: Character set not supported: gb18030

gMusic.wsf(0, 1) Windows Script Host: Cannot convert text to UNICODE for processing
精简
=> 个人网志
Floor 3 Posted 2010-11-14 08:32 ·  中国 北京 华为云
金牌会员
★★★★
Credits 2,725
Posts 1,160
Joined 2006-09-23 12:00
19-year member
UID 63486
From 河北廊坊
Status Offline
Thanks for sharing
三人行,必有吾师焉。 学然后知不足,教然后知困,然后能自强也。
Floor 4 Posted 2010-11-14 17:48 ·  中国 北京 联通
高级用户
★★★
据说是李先生
Credits 609
Posts 400
Joined 2008-04-23 15:55
18-year member
UID 116706
Gender Male
Status Offline
Originally posted by netbenton at 2010-11-14 08:20:
It didn't work for me. The error messages are as follows:


gMusic.wsf(0, 1) Windows Script Host: Character set not supported : gb18030

gMusic.wsf(0, 1) Windows Script Host: Cannot convert text to UNICODE for processing

What kind of computer do you have that doesn't support this encoding...
Then you can try opening the code with Notepad, change gb18030 in the first line to gb2312, this should be supported, save it in ANSI format;
Or delete encoding="gb18030" and save it in UNICODE format, it should work.
Floor 5 Posted 2010-11-14 19:43 ·  中国 广东 佛山 电信
银牌会员
★★★★
SuperCleaner
Credits 2,362
Posts 1,133
Joined 2008-02-02 21:36
18-year member
UID 110072
Gender Male
Status Offline
The broken computer has no speaker... But this post needs to be topped!
Floor 6 Posted 2010-11-15 04:41 ·  中国 广东 东莞 电信
银牌会员
★★★
批处理编程迷
Credits 1,916
Posts 752
Joined 2008-12-28 04:30
17-year member
UID 135147
Gender Male
From 广西
Status Offline
Changed gb18030 to gb2312,
Really can put it, good yeah~~~~
Need to study it well~~
Thank the LZ for sharing~~
精简
=> 个人网志
Floor 7 Posted 2010-11-20 15:02 ·  中国 广东 韶关 电信
高级用户
★★★
CMD感染者
Credits 691
Posts 383
Joined 2008-05-23 00:38
18-year member
UID 119451
Gender Male
Status Offline
Floor 8 Posted 2010-11-21 13:54 ·  中国 台湾 中华电信(HiNet)
初级用户
Credits 34
Posts 22
Joined 2010-11-20 09:26
15-year member
UID 177913
Gender Male
Status Offline
We need to study it carefully.
Floor 9 Posted 2010-11-21 14:49 ·  中国 天津 电信
初级用户
★★
小鸟鸟
Credits 120
Posts 74
Joined 2010-05-08 01:53
16-year member
UID 166347
Gender Male
From 河北
Status Offline
This must be kept!
Floor 10 Posted 2010-11-21 18:52 ·  中国 广东 佛山 顺德区 电信
初级用户
★★
Credits 151
Posts 106
Joined 2009-10-09 21:24
16-year member
UID 152856
Gender Male
From 河南省
Status Offline
This doesn't seem to run under CMD... Here it calls PLAYER to play it.
Floor 11 Posted 2010-11-24 16:43 ·  中国 河南 商丘 电信
新手上路
Credits 1
Posts 1
Joined 2010-11-23 23:21
15-year member
UID 178155
Gender Male
Status Offline
Got it!
Floor 12 Posted 2010-12-07 07:21 ·  中国 广东 东莞 电信
银牌会员
★★★
批处理编程迷
Credits 1,916
Posts 752
Joined 2008-12-28 04:30
17-year member
UID 135147
Gender Male
From 广西
Status Offline
After looking at the commented source code, I finally understand something.

There are many things worth learning.
精简
=> 个人网志
Floor 13 Posted 2010-12-07 15:56 ·  中国 天津 联通
新手上路
Credits 1
Posts 1
Joined 2010-11-27 12:52
15-year member
UID 178362
Gender Male
Status Offline
Still need player support
Floor 14 Posted 2010-12-07 22:32 ·  中国 山东 东营 联通
贫困用户
Credits -3
Posts 30
Joined 2007-08-13 22:25
18-year member
UID 95082
Gender Male
Status Offline
Received!!!
Floor 15 Posted 2010-12-08 10:48 ·  中国 北京 联通
高级用户
★★★
据说是李先生
Credits 609
Posts 400
Joined 2008-04-23 15:55
18-year member
UID 116706
Gender Male
Status Offline
Originally posted by lqs623 at 2010-12-7 22:32:
Got it!!!!!

There are actually poor people coming to support! Did you delete your posts until you were poor?
Forum Jump: