Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
65 changes: 5 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,8 @@
# MP3 Player - Second Weekend Assignment
You are going to implement an MP3 player.
THIS SECOND WEEKEND ASSIGNMENT IN JAVASCRIPT
the task is to implement an MP3 player.


## Instructions
1. Fork this repo into your account.
2. Clone the forked repo to your computer.
3. Execute `npm install` in the project folder to install the [tests](#testing).
4. Create a new git branch for your work.
5. Complete the project [requirements](#requirements).
6. Remember to push your commits regularly to GitHub.
7. Submit your work (explanation [below](#submission))
8. Good luck & have fun!


## Requirements
The player itself is an object that has:
- `songs`: an array of songs
- `playlists`: an array of playlists
- `playSong`: a method that plays a song.
It receives a song object and should print the following format `"Playing {song.title} from {song.album} by {song.artist} | {song.duration}."` (replace the stuff inside the `{}` with the real values).
The song duration should be in `mm:ss` format (for example 02:40).

A song object has:
- `id`: a unique ID (a number)
Expand All @@ -33,7 +16,7 @@ A playlist object has:
- `name`: a name
- `songs`: an array of song IDs

You are asked to implement the following functions:
This Are The Main Functions Of The Task:
- `playSong` - Gets a song ID. Uses `player.playSong` to play the song with the given ID.
- `removeSong` - Gets a song ID. Removes the song with the given ID from the player (from songs and playlists).
- `addSong` - Gets a title, album, artist, duration & ID. Adds a new song with given properties to the player. The ID is optional, and if omitted should be automatically generated. The song duration should be in `mm:ss` format (for example 06:27). Returns the ID of the new song.
Expand All @@ -45,47 +28,9 @@ You are asked to implement the following functions:
- `searchByQuery` - Gets a query string. Returns a results object, which has:
- `songs`: an array of songs in which either title or album or artist contain the query string. The songs should be sorted by their titles.
- `playlists`: an array of playlists in which the name contains the query string. The playlists should be sorted by their names.

The comparison in both cases should be case-insensitive.

- `searchByDuration` - Gets a duration in `mm:ss` format (for example 11:03). Returns the song, or playlist, with the closest duration to what was given.


## Testing
We have added some automated tests for you to use. They will help you make sure your code covers the requirements.

To run the tests, execute `npm run test` in the project folder.

__Note__: These tests might not cover everything. Don't just count on them. You should remain responsible and vigilant for other possible edge-cases.


## Grading
Your work will be graded based on the following considerations:
- The number of automatic tests you pass
- Readable and ordered code
- Spacing & indentation
- Indicative vairable/function names
- Comments (where necessary)
- Proper use of Git
- Granular commits
- Descriptive commit messages
- Extra features you might have added


## Submission
1. On GitHub, open a pull request from your branch to the main branch.
2. __Do not merge the pull request!__
3. Add the user `Cyber4sPopo` as collaborator to your repo.
4. Submit a link to the pull request in Google Classroom.


## Important Tip
Try to work in small iterations. You've got a big and complex task ahead of you. Break it down into smaller tasks. Concentrate on making small progress every time. Do it step by step.


## Remarks
- The player object must be stored in a global variable called `player`.
- The function, method & property names should be __exactly__ as described above (for the tests to function).
- __Avoid code duplication!__ You are free to add as many extra functions as you like.
- Pay attention to edge-cases! Your code should throw errors when the user tries to do something invalid (delete a song that doesn't exist, etc.).
- You can use all the material you've learned so far, including extras you've learned on your own.
- Write your code in the `index.js` file. It contains a template which you can use as the basis for your code.
There are many side functions that includes on the code. this functions should break the main functions to small functions that are more simple.
Loading