initial commit
This commit is contained in:
commit
19e1d283f8
74
.gitignore
vendored
Normal file
74
.gitignore
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
|
||||
fmframework/src/sarsoo/fmframework/net/Key.java
|
||||
|
||||
# Directories #
|
||||
/build/
|
||||
/bin/
|
||||
target/
|
||||
|
||||
# OS Files #
|
||||
.DS_Store
|
||||
|
||||
*.class
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
*.db
|
||||
|
||||
######################
|
||||
# Windows
|
||||
######################
|
||||
|
||||
# Windows image file caches
|
||||
Thumbs.db
|
||||
|
||||
# Folder config file
|
||||
Desktop.ini
|
||||
|
||||
######################
|
||||
# OSX
|
||||
######################
|
||||
|
||||
.DS_Store
|
||||
.svn
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear on external disk
|
||||
.Spotlight-V100
|
||||
.Trashes
|
||||
|
||||
|
||||
######################
|
||||
# Eclipse
|
||||
######################
|
||||
|
||||
*.pydevproject
|
||||
.project
|
||||
.metadata
|
||||
bin/**
|
||||
tmp/**
|
||||
tmp/**/*
|
||||
*.tmp
|
||||
*.bak
|
||||
*.swp
|
||||
*~.nib
|
||||
local.properties
|
||||
.classpath
|
||||
.settings/
|
||||
.loadpath
|
||||
/src/main/resources/rebel.xml
|
||||
# External tool builders
|
||||
.externalToolBuilders/
|
||||
|
||||
# Locally stored "Eclipse launch configurations"
|
||||
*.launch
|
||||
|
||||
# CDT-specific
|
||||
.cproject
|
||||
|
||||
# PDT-specific
|
||||
.buildpath
|
1
fmframework/.gitignore
vendored
Normal file
1
fmframework/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/.project
|
14
fmframework/src/sarsoo/fmframework/music/Album.java
Normal file
14
fmframework/src/sarsoo/fmframework/music/Album.java
Normal file
@ -0,0 +1,14 @@
|
||||
package sarsoo.fmframework.music;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Album extends FMObj{
|
||||
protected int id;
|
||||
protected String date;
|
||||
protected Artist artist;
|
||||
protected int listeners;
|
||||
protected int playCount;
|
||||
protected ArrayList<Tag> tagList;
|
||||
protected ArrayList<Track> trackList;
|
||||
|
||||
}
|
14
fmframework/src/sarsoo/fmframework/music/Artist.java
Normal file
14
fmframework/src/sarsoo/fmframework/music/Artist.java
Normal file
@ -0,0 +1,14 @@
|
||||
package sarsoo.fmframework.music;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Artist extends FMObj{
|
||||
protected int listeners;
|
||||
protected int plays;
|
||||
protected boolean streamable;
|
||||
protected ArrayList<Album> albums;
|
||||
protected ArrayList<Track> tracks;
|
||||
protected ArrayList<Artist> similarArtists;
|
||||
protected ArrayList<Tag> tagList;
|
||||
protected Wiki wiki;
|
||||
}
|
5
fmframework/src/sarsoo/fmframework/music/Bio.java
Normal file
5
fmframework/src/sarsoo/fmframework/music/Bio.java
Normal file
@ -0,0 +1,5 @@
|
||||
package sarsoo.fmframework.music;
|
||||
|
||||
public class Bio {
|
||||
public String date;
|
||||
}
|
21
fmframework/src/sarsoo/fmframework/music/FMObj.java
Normal file
21
fmframework/src/sarsoo/fmframework/music/FMObj.java
Normal file
@ -0,0 +1,21 @@
|
||||
package sarsoo.fmframework.music;
|
||||
|
||||
public class FMObj {
|
||||
|
||||
protected String name;
|
||||
protected String url;
|
||||
protected String mbid;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public String getMbid() {
|
||||
return mbid;
|
||||
}
|
||||
|
||||
}
|
11
fmframework/src/sarsoo/fmframework/music/Tag.java
Normal file
11
fmframework/src/sarsoo/fmframework/music/Tag.java
Normal file
@ -0,0 +1,11 @@
|
||||
package sarsoo.fmframework.music;
|
||||
|
||||
public class Tag {
|
||||
protected String name;
|
||||
protected String url;
|
||||
protected int reach;
|
||||
protected int taggings;
|
||||
protected Boolean streamable;
|
||||
protected String summary;
|
||||
protected String content;
|
||||
}
|
17
fmframework/src/sarsoo/fmframework/music/Track.java
Normal file
17
fmframework/src/sarsoo/fmframework/music/Track.java
Normal file
@ -0,0 +1,17 @@
|
||||
package sarsoo.fmframework.music;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Track extends FMObj{
|
||||
protected Album album;
|
||||
protected Artist artist;
|
||||
protected int trackNumber;
|
||||
protected int id;
|
||||
protected int duration;
|
||||
protected int playcount;
|
||||
protected boolean streamable;
|
||||
protected ArrayList<Tag> tagList;
|
||||
protected Wiki wiki;
|
||||
|
||||
|
||||
}
|
7
fmframework/src/sarsoo/fmframework/music/Wiki.java
Normal file
7
fmframework/src/sarsoo/fmframework/music/Wiki.java
Normal file
@ -0,0 +1,7 @@
|
||||
package sarsoo.fmframework.music;
|
||||
|
||||
public class Wiki {
|
||||
protected String date;
|
||||
protected String summary;
|
||||
protected String content;
|
||||
}
|
45
fmframework/src/sarsoo/fmframework/net/Network.java
Normal file
45
fmframework/src/sarsoo/fmframework/net/Network.java
Normal file
@ -0,0 +1,45 @@
|
||||
package sarsoo.fmframework.net;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class Network {
|
||||
public static void apiAlbumInfoCall(String artist, String album, String username) {
|
||||
try {
|
||||
|
||||
String urlString = String.format("http://ws.audioscrobbler.com/2.0/?method=album.getInfo&artist=%s&album=%s&autocorrect=1&username=%s&format=json&api_key=%s",
|
||||
artist, album, username, Key.getKey());
|
||||
URL url = new URL(urlString);
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("GET");
|
||||
conn.setRequestProperty("Accept", "application/json");
|
||||
|
||||
if (conn.getResponseCode() != 200) {
|
||||
throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
|
||||
}
|
||||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));
|
||||
|
||||
String output;
|
||||
System.out.println("Output from Server .... \n");
|
||||
while ((output = br.readLine()) != null) {
|
||||
System.out.println(output);
|
||||
}
|
||||
|
||||
conn.disconnect();
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
} catch (IOException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
44
fmframework/src/sarsoo/fmframework/net/TestCall.java
Normal file
44
fmframework/src/sarsoo/fmframework/net/TestCall.java
Normal file
@ -0,0 +1,44 @@
|
||||
package sarsoo.fmframework.net;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
public class TestCall {
|
||||
|
||||
public static void main(String [] args) {
|
||||
try {
|
||||
URL url = new URL("http://ws.audioscrobbler.com/2.0/?method=artist.getInfo&artist=Mastodon&format=json&api_key=" + Key.getKey());
|
||||
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
||||
conn.setRequestMethod("GET");
|
||||
conn.setRequestProperty("Accept", "application/json");
|
||||
|
||||
if (conn.getResponseCode() != 200) {
|
||||
throw new RuntimeException("Failed : HTTP error code : " + conn.getResponseCode());
|
||||
}
|
||||
|
||||
BufferedReader br = new BufferedReader(new InputStreamReader((conn.getInputStream())));
|
||||
|
||||
String output;
|
||||
System.out.println("Output from Server .... \n");
|
||||
while ((output = br.readLine()) != null) {
|
||||
System.out.println(output);
|
||||
}
|
||||
|
||||
conn.disconnect();
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
} catch (IOException e) {
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user