请考虑以下网址
http://m3u.com/tunein.m3u http://asxsomeurl.com/listen.asx:8024 http://www.plssomeotherurl.com/station.pls?id=111 http://22.198.133.16:8024
什么是确定文件扩展名(.m3u/.asx/.pls)的正确方法?显然,最后一个没有文件扩展名.
编辑:我忘了提到m3u/asx/pls是音频流的播放列表(文本文件),必须以不同的方式进行解析.目标确定扩展,然后将url发送到正确的解析函数.例如
url = argv[1]
ext = GetExtension(url)
if ext == "pls":
realurl = ParsePLS(url)
elif ext == "asx":
realurl = ParseASX(url)
(etc.)
else:
realurl = url
Play(realurl)
GetExtension()应该返回文件扩展名(如果有的话),最好不要连接到URL. 我们有5个人在同一个项目上工作,在Bitbucket有几个GIT存储库.每个用户都有自己的Bitbucket帐户.我正在寻找具有某种团队或组织功能的最佳实践方法,以便我们可以在相同的存储库上工作?作为用例,当我克隆存储库时,其他用户无法将其推送到同一存储库.我希望有一些解决方法,而不是每个人都使用相同的用户帐户.
我希望这是正确解释的.
非常感谢!
请多多包涵.Docker相当新鲜.
我正在使用CodeDeploy将Docker容器(已分离)部署到AWS EC2注册表.在部署时,在设置一些环境变量等后运行以下命令:
exec docker run -d ${PORTS} -v cache-${CACHE_VOLUME} --env-file $(dirname $0)/docker.env --tty "${IMAGE}:${TAG}"
Run Code Online (Sandbox Code Playgroud)
容器运行在EC2 Container Service中定位和标记的图像.到目前为止没问题.
由于这是一个PHP应用程序(特别是Symfony2应用程序),我通常需要发出以下命令来执行部署时的数据库迁移:
php app/console doctrine:migrations:migrate --no-interaction
Run Code Online (Sandbox Code Playgroud)
现在,是否有任何在"docker run ..."期间运行此命令同时保持容器运行,或者我是否需要专门为此命令运行另一个容器?
非常感谢!
所以我想通过以下字段对Solr响应进行排序:
问题是status_color必须按以下值排序(ei不按字母顺序):
该字段可能只包含其中一个值.
我希望有一种方法可以在Solr查询中执行此操作,而不是在代码中按摩结果.由于数百个文件的结果,它不是一个真正的选择.
任何帮助表示赞赏.
我无法使用jQueryMobile链接到移动网站上的PDF文档.
该链接使用jQueryMobile-effects打开,并显示一个文本为"undefined"的页面.
任何帮助表示赞赏!
所以我的 Solr 文档中有以下多字段(只是一个例子)。
"type": [
"Single",
"Series",
"Other association"
],
"name": [
"Name associated with first type",
"Name associated with second type",
"Name associated with third type"
]
Run Code Online (Sandbox Code Playgroud)
我将能够查询两个字段:
name:"Name associated with third type" AND type:"Series"
Run Code Online (Sandbox Code Playgroud)
但我需要查询 的值name并匹配type同一数组索引中的值。所以上面的例子不应该命中,因为“与第三种类型关联的名称”是第三种,name而“系列”在type.
应该产生命中的查询是这样的,因为两个值都在同一个数组索引中。
name:"Name associated with second type" AND type:"Series"
Run Code Online (Sandbox Code Playgroud)
但这符合一切。我希望这得到了正确的解释。我什至不知道这是否可能。
我在Python中编写了一个小的gui-frontend,让用户可以播放互联网广播频道.该程序使用Pythons subprocess()来启动mplayer以调入一个通道,例如:
runn = "mplayer http://77.111.88.131:8010"
p = subprocess.Popen(runn, shell=True)
pid = int(p.pid)
wait = os.waitpid(p.pid, 1)Run Code Online (Sandbox Code Playgroud)
然后保存p.pid,当用户想要停止监听时,使用以下代码:
os.kill(p.pid, 9)Run Code Online (Sandbox Code Playgroud)
这在OpenSUSE中完美运行,但在Ubuntu中不行.似乎Ubuntu实际上启动了两个独立的进程.终端输出:
Opensuse 11.3:
$ pgrep mplayer
22845
Run Code Online (Sandbox Code Playgroud)
Ubuntu 10.04:
$ pgrep mplayer
22846
22847
Run Code Online (Sandbox Code Playgroud)
这在运行其他程序时也适用.有谁知道为什么?我真的希望这个应用程序在所有发行版上运行,所以任何帮助都非常感谢.
我正在Python中编写一个简单的前端,使用mplayer(在子进程中)播放和录制互联网广播频道(例如来自shoutcast).当用户单击工作站时,将运行以下代码:
url = http://77.111.88.131:8010 # only an example
cmd = "mplayer %s" % url
p = subprocess.Popen(cmd.split(), shell=False)
wait = os.waitpid(p.pid, 1)
return int(p.pid)
这完美地工作,流开始播放它应该.虽然我想以某种方式解析流的标题.看来我需要从mplayer输出中获取标题.这是我在终端中播放流时的输出:
$ mplayer http://77.111.88.131:8010 MPlayer 1.0rc4-4.4.5 (C) 2000-2010 MPlayer Team mplayer: could not connect to socket mplayer: No such file or directory Failed to open LIRC support. You will not be able to use your remote control. Playing http://77.111.88.131:8010. Resolving 77.111.88.131 for AF_INET6... Couldn't resolve name for AF_INET6: 77.111.88.131 Connecting to server 77.111.88.131[77.111.88.131]: 8010... Name : …
我正在使用Tkinter和Python创建一个简单的GUI应用程序,但是我在向单个框架添加滚动条时遇到了问题.该框架是可见的由上到我20" 底部,但为了显示在上网本上或其他任何低分辨率的屏幕,它需要一个滚动条的一切.这里是我怎么想它会工作(将其与列表框一样)一个片断.
framelist = Tkinter.Frame(self.pmaster, relief=FLAT, borderwidth=0)
framelist.pack(fill=BOTH, padx=0, pady=0)
yscroll = Tkinter.Scrollbar(framelist, width=10, orient=VERTICAL)
yscroll.pack(fill=Y,side=RIGHT,padx=0,pady=0)
Run Code Online (Sandbox Code Playgroud)
虽然这显然不适用于帧.我们将非常感谢您对此问题的任何帮助!
我也想知道Tkinter是否会过时.这是我在学校学到的唯一一个GUI界面,但几年前就已经不再符合我的要求了.当然必须有更好的选择吗?我在Ubuntu顺便说一下.
我一直在尝试根据python中的url获取互联网广播电台的名称/标题,但到目前为止还没有运气.似乎互联网广播电台使用的是除HTTP之外的其他协议,但如果我错了,请纠正我.
例如:http://89.238.146.142: 7030
标题是:"Ibiza Global Radio"
如何将此标题存储在变量中?任何帮助将深深感激:)
亲切的问候,frigg
使用Varnish 3.0.7.为了转发任何非SSL连接,我已将以下子例程添加到我的VCL:
sub vcl_synth {
if (resp.status == 750) {
set resp.status = 301;
set resp.http.Location = req.http.x-redir;
return(deliver);
}
}
Run Code Online (Sandbox Code Playgroud)
然后在vcl_recv我添加:
if ((req.http.host ~ "^(?i)mydomain(?i)") && req.http.X-Forwarded-Proto !~ "(?i)https") {
set req.http.x-redir = "https://" + req.http.host + req.url;
return(synth(750, ""));
}
Run Code Online (Sandbox Code Playgroud)
但是我收到以下错误:
Message from VCC-compiler:
Expected return action name.
('input' Line 225 Pos 16)
return(synth(750, ""));
---------------#####------------
Run Code Online (Sandbox Code Playgroud)
有谁知道为什么会这样?经过几个小时的调试后我一无所知......
非常感谢!
请考虑以下字符串:
$strings = array(
"8.-10. stage",
"8. stage"
);
Run Code Online (Sandbox Code Playgroud)
我想提取每个字符串的第一个整数,所以它会返回
8
8
Run Code Online (Sandbox Code Playgroud)
我试图用preg_replace过滤掉数字,但它返回所有整数,我只想要第一个.
foreach($strings as $string)
{
echo preg_replace("/[^0-9]/", '',$string);
}
Run Code Online (Sandbox Code Playgroud)
有什么建议?
python ×5
php ×2
solr ×2
subprocess ×2
amazon-ec2 ×1
bitbucket ×1
docker ×1
file ×1
frame ×1
git ×1
mplayer ×1
mysql ×1
parsing ×1
preg-replace ×1
radio ×1
scrollbar ×1
shoutcast ×1
sorting ×1
ssl ×1
stream ×1
symfony ×1
tk-toolkit ×1
tkinter ×1
varnish ×1
varnish-vcl ×1