问题标签 [last.fm]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
444 浏览

ruby-on-rails - 在 Rails 3 中聚合数据

我想汇总来自不同来源的数据,Twitter lastfm 和那种。我只是不知道如何存储数据。显然在数据库中,但我无法弄清楚在不影响对每列中数据的逻辑理解的情况下如何使表保持所有这些数据的抽象。我想知道是否有其他人有这方面的经验,现在他们在 Rails 中解决了这个问题。

0 投票
2 回答
2198 浏览

jquery - 使用带有 Last.FM API 的 jQuery $.ajax 创建/访问 JSON 对象

我最近更改了我的网站设计,现在需要对我的数据使用动态 AJAX 请求。基本上,我正在尝试使用 JSON 格式的 Last.FM API 检索用户数据。

我对此很陌生,尤其是 JSON,这让我有点头疼!我知道我一定错过了一些简单的东西。

这是一些非常基本的代码来测试功能,但它没有检索任何东西!

有什么建议么?

我希望能够在整个页面中使用 JSON 对象,例如,我可以随时调用 topartists.artist[i].playcount; 显示播放次数等。我该怎么做?

0 投票
3 回答
3770 浏览

python - Python Not Importing

So i downloaded the lastfm api for python made by people. found here: http://code.google.com/p/python-lastfm/

I have a website hosting through dreamhost. I wasnt able to build the module using:
python setup.py build
in my shell that i used putty to get into. But when i would run
python setup.py install
it would return an error. Figuring that all install really does is throw the files from the lib dir into the python site-packages folder, i decided to try and manually do it. I was successful in doing so on my local machine and was able to run python and type import lastfm with no errors. But i could not get it working on my webhost.

I do have quite the clusterfuck currently on my webhost due to my n00bism, by that i mean i tried installing python multiple times, and i dont really know where it installed successfully. All i know is i can go to putty and type python and it will run, but i dont know exactly where from. So i copied the lastfm build over to every python2.x/lib/site-packages i could find, but to no avail.

I dont know what im doing wrong. It says pythons os path is usr/lib/python2.5 and i figure usr means the root or local. idk. im very confused.

I also am curious because i am able to import things like mysql and sqlite by typing
import MySQLdb
import sqlite
import sqlite3

and all those work, yet i dont see them anywhere in my python path.

thanks in advance. if i need to list more info please tell me. thanks!

edit:

$ python setup.py install running install error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the installation directory:

The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was:

Perhaps your account does not have write access to this directory? If the installation directory is a system-owned directory, you may need to sign in as the administrator or "root" account. If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable.

For information on other options, you may wish to consult the documentation at:

http://peak.telecommunity.com/EasyInstall.html

Please make the appropriate changes for your system and try again.


that is the error i would get when i would try to do python setup.py install

0 投票
4 回答
7023 浏览

php - PHP exec python不工作

嘿,你们。我在 Dreamhost 的网络服务器上运行 python。我正在使用他们安装的 python 并且正在使用可以在这里找到的 lastfm 模块:http ://code.google.com/p/python-lastfm/

为了让它正确导入,我这样做

因为 lastfm 模块安装在那里。

当我使用 putty ssh 进入我的服务器时,我可以简单地运行 python test.py 并且它运行良好。但是当我从一个 php 脚本运行它时

据说它不起作用,脚本也没​​有运行。当我这样做时它运行得很好

然后还有其他事情,但是当我真正尝试对模块做一些事情时,比如:

它不运行。再一次,我可以在 shell 中使用相同的 python 安装运行脚本,它执行得很好。因此,当我从 php 脚本运行它时,一定发生了一些错误。我想它会运行完全相同的 python 和一切。我检查了其他帖子,他们说这可能是具有文件权限的东西,但是我将每个文件都放到了 777 中,但它仍然无法正常工作。我知道问题可能是什么。提前感谢大家。

0 投票
1 回答
684 浏览

javascript - 谷歌地图信息窗口关闭?

作为我的 last.fm/google maps 事件混搭的一部分,我必须将标记从 last.fm API 动态绘制到 google 地图上。

这一切都很好,但是当我单击标记时,只显示最后一个信息窗口(对于一个演出)。我知道这样做的原因,但很难实施。

目前,我正在通过所有动态演出的位置(坐标)运行 PHP 循环,然后将其传递给 javascript。这对我来说更有意义——而且我对 PHP 的了解比 JS 要好得多:

我怎么能在不完全重构循环到 JS 而不是 PHP 等的情况下添加闭包。除非这是唯一的解决方案之一?

非常感谢。

0 投票
1 回答
1839 浏览

php - OSError: [Errno 22] Python PHP 问题

我之前问过一个类似的问题,但我终于在解决它方面取得了进一步的进展,但现在我被卡住了。

我在 Dreamhost 的网络服务器上运行 python。我使用 putty 进入它并运行我的 python 脚本,它工作得很好。但是当我使用 exec 从 php 运行它时,它崩溃了。

在 php 中使用 passthru() 函数时,我会返回此错误:

我不知道这意味着什么或我应该从哪里开始。有关更多信息,我正在使用此处找到的 python lastfm 模块:http ://code.google.com/p/python-lastfm/

我的python脚本只是这样做:

任何帮助将不胜感激,或任何想法。我什至不知道从哪里开始。

编辑:我做了更多的工作,发现最后一行是:

GetUsername 函数就是这样的:

缩进不在这里更正。

0 投票
2 回答
718 浏览

json - 使用 JS/AJAX (Last.fm) 在 JSON 对象中搜索特定值

我正在使用 Last.fm API 以JSON 格式返回数据,这工作正常。我正在使用user.getTopArtist() API 调用。

在页面加载时,会为每个艺术家创建一个 DIV 对象,其中包含来自 JSON 数据的相关详细信息。当用户使用 DIV 执行操作时,我基本上想交换图像 url 以显示更大的图像尺寸!

如何通过匹配它的存储值来查找/引用 JSON 对象?

例如,如果我需要匹配艺术家姓名“Kate Bush”,然后检索“超大”图像 url。我该怎么做?

数据结构如下所示:

0 投票
1 回答
584 浏览

javascript - Last.fm api 和 & 字符

这是我的 javascript 代码,我使用 infourl 进行 getJson 查询。但正如您所见,艺术家变量有一个&字符,并且 last.fm api 返回名为 Marina 的艺术家,而不是 Marina & the Diamonds。同时,网址似乎很好:

任何的想法?谢谢

0 投票
2 回答
475 浏览

python - 我需要帮助使用 pylast 的 library.add_album 功能(python last.fm api wrapper)

我正在尝试访问 pylast 的库类,但一定是做错了什么。我可以让大多数其他功能正常工作。以下是一个代码示例,它仅采用标准工作示例,并添加了我认为将专辑添加到我的 last.fm 库的正确方法:

ss pylast 的库类,但一定是做错了什么。我可以让大多数其他功能正常工作。以下是一个代码示例,它仅采用标准工作示例,并添加了我认为将专辑添加到我的 last.fm 库的正确方法:

我是python的新手,所以如果这很明显,我很抱歉,我刚刚被困了好几天,决定问一下。

0 投票
1 回答
794 浏览

node.js - 是否 express for node.js 有一个 .request()

我正在尝试使用以下代码从外部 url 获得响应,但我没有运气。有人可以阐明我做错了什么,并给出他们认为可能有帮助的任何指示。