Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djrandom-py-deleted-112
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This project is pending deletion, and will be deleted on
2025-06-14
. Repository and other project resources are read-only.
Show more breadcrumbs
ale
djrandom-py-deleted-112
Commits
e2e0cbc3
Commit
e2e0cbc3
authored
13 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
make random work
parent
5905b382
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/djrandom/frontend/static/js/djr/backend.js
+22
-3
22 additions, 3 deletions
server/djrandom/frontend/static/js/djr/backend.js
server/djrandom/frontend/static/js/djr/player.js
+3
-3
3 additions, 3 deletions
server/djrandom/frontend/static/js/djr/player.js
with
25 additions
and
6 deletions
server/djrandom/frontend/static/js/djr/backend.js
+
22
−
3
View file @
e2e0cbc3
...
@@ -199,13 +199,14 @@ djr.Backend.prototype.lastPlaylist = function(num, callback ,ctx) {
...
@@ -199,13 +199,14 @@ djr.Backend.prototype.lastPlaylist = function(num, callback ,ctx) {
};
};
/**
/**
* Re
quest N most play
ed
s
on
gs
* Re
turn N pseudo-random songs bas
ed on
the current playlist.
*
*
* @param {integer} n Number of songs requested
* @param {integer} n Number of songs requested
* @param {Array[string]} uuids SHA1 hashes of the current playlist
*
*
*/
*/
djr
.
Backend
.
prototype
.
random
Playlist
=
function
(
num
,
uuids
,
callback
,
ctx
)
{
djr
.
Backend
.
prototype
.
markov
Playlist
=
function
(
num
,
uuids
,
callback
,
ctx
)
{
$
.
ajax
({
url
:
'
/json/
random
'
,
$
.
ajax
({
url
:
'
/json/
markov
'
,
data
:
{
'
h
'
:
uuids
.
join
(
'
,
'
),
data
:
{
'
h
'
:
uuids
.
join
(
'
,
'
),
'
n
'
:
num
},
'
n
'
:
num
},
dataType
:
'
json
'
,
dataType
:
'
json
'
,
...
@@ -217,3 +218,21 @@ djr.Backend.prototype.randomPlaylist = function(num, uuids, callback ,ctx) {
...
@@ -217,3 +218,21 @@ djr.Backend.prototype.randomPlaylist = function(num, uuids, callback ,ctx) {
});
});
};
};
/**
* Return N completely random songs.
*
* @param {integer} n Number of songs requested
*
*/
djr
.
Backend
.
prototype
.
randomPlaylist
=
function
(
num
,
callback
,
ctx
)
{
$
.
ajax
({
url
:
'
/json/random
'
,
data
:
{
'
n
'
:
num
},
dataType
:
'
json
'
,
type
:
'
GET
'
,
context
:
ctx
||
this
,
success
:
function
(
data
,
status
,
jqxhr
)
{
callback
(
data
.
results
);
}
});
};
This diff is collapsed.
Click to expand it.
server/djrandom/frontend/static/js/djr/player.js
+
3
−
3
View file @
e2e0cbc3
...
@@ -118,8 +118,8 @@ djr.Player.prototype.lastPlaylist = function(num) {
...
@@ -118,8 +118,8 @@ djr.Player.prototype.lastPlaylist = function(num) {
djr
.
Player
.
prototype
.
randomPlaylist
=
function
(
num
)
{
djr
.
Player
.
prototype
.
randomPlaylist
=
function
(
num
)
{
var
player
=
this
;
var
player
=
this
;
var
title
=
"
Last
"
+
num
+
"
Random Songs
"
;
var
title
=
""
+
num
+
"
Random Songs
"
;
this
.
backend
.
randomPlaylist
(
num
,
this
.
playlist
.
allSongs
(),
function
(
results
)
{
this
.
backend
.
randomPlaylist
(
num
,
function
(
results
)
{
var
songs
=
results
;
var
songs
=
results
;
if
(
songs
.
length
==
0
)
{
if
(
songs
.
length
==
0
)
{
djr
.
debug
(
'
No results found.
'
);
djr
.
debug
(
'
No results found.
'
);
...
@@ -133,7 +133,7 @@ djr.Player.prototype.randomPlaylist = function(num) {
...
@@ -133,7 +133,7 @@ djr.Player.prototype.randomPlaylist = function(num) {
djr
.
Player
.
prototype
.
mostPlayedPlaylist
=
function
(
num
)
{
djr
.
Player
.
prototype
.
mostPlayedPlaylist
=
function
(
num
)
{
var
player
=
this
;
var
player
=
this
;
var
title
=
"
Most
"
+
num
+
"
Played Songs
"
;
var
title
=
""
+
num
+
"
Most
Played Songs
"
;
this
.
backend
.
mostPlayedPlaylist
(
num
,
function
(
results
)
{
this
.
backend
.
mostPlayedPlaylist
(
num
,
function
(
results
)
{
var
songs
=
[];
var
songs
=
[];
$
.
each
(
results
,
function
(
idx
,
item
)
{
$
.
each
(
results
,
function
(
idx
,
item
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment