Giter Club home page Giter Club logo

powerlfm's People

Contributors

camusicjunkie avatar jabbahudson avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

powerlfm's Issues

Get-LFMUserRecentTrack outputs 2 objects when -Limit is 1 and NowPlaying

When a track is currently playing NowPlaying is set to $true. When Get-LFMUserRecentTrack is called with a limit of 1, two tracks are displayed.

Change structure of code below and add another check when limit equals 1.

if ($PSBoundParameters.ContainsKey('EndDate') -and $track.'@attr'.NowPlaying -eq 'true') {
    $trackInfo = $trackInfo[1]
}

Change the way the different tokens are stored

Move from the registry to using the Windows Password Vault to store the API token, session key, and shared secret. This is mostly to appease PSScriptAnalyzer. Using ConvertTo-SecureString $TextToEncrypt -AsPlainText -Force isn't best practice.

Remove integration tests from each test file

These tests shouldn't have to account for whether the Last.fm API is actually working. The integration tests will probably get removed as the API should already be tested on their end.

Fix types for parameters on all functions

Some functions have incorrect types. For example some parameters are set up as so...
[string] Id or [string] Limit. They should be [guid] Id or [int] Limit respectively.

This will break the interface tests for all functions where the type is changed. All those tests will have to be updated.

Change format for all test files when checking for OutputType

Change It block format to check for a matching string instead of checking for true.

Current:

It 'Should contain an output type of PowerLFM.Album.Info' {
    $command.OutputType.Name -contains 'PowerLFM.Album.Info' | Should -BeTrue
}

Proposed:

It 'Should contain an output type of PowerLFM.Album.Info' {
    $command.OutputType.Name | Should -Be 'PowerLFM.Album.Info'
}

Change format of all tests when checking for parameter set name

Change format of it block when testing for parameter set name. Use assertion contain instead of betrue.

Current:

It 'Should have a parameter set of album' {
    $command.ParameterSets.Name -contains 'album' | Should -BeTrue
}

Proposed:

It 'Should have a parameter set of album' {
    $command.ParameterSets.Name | Should -Contain 'album'
}

[Suggestion] add a $artist.latestalbum method

Thanks for your module, I was going to try something similar to show/notify me of any new albums put out by my favourite artists. (I will export a list of artists with powershell eg. get-childitem -path Z:\MUSIC)

It would be cool to have something like $artist.latestalbum which could include year, so it could be filtered.

Thoughts? Cheers

Adding caching capability to Set-LFMTrackScrobble

If there is currently no connection to Last.fm when this function is run it should cache all tracks played. It should cache them in a persistent way that will survive restarts. Maybe a simple text file in the user's AppData folder.

When this function is run, and the connection to Last.fm is reestablished, it should check for this file and scrobble all tracks it contains.

Change user functions to make username not mandatory

Remove mandatory attribute from parameter block for UserName parameter. Add key for the session key to the apiParams hashtable. See below for example:

begin {
    $apiParams = @{
        'method' = 'user.GetInfo'
        'api_key' = $LFMConfig.APIKey
        'sk' = $LFMConfig.SessionKey
        'format' = 'json'
    }
}

Package Microsoft.PowerShell.SecretManagement with PowerLFM

Currently the SecretManagement module is a prerelease so it can't be set as a required module in PowerLFM and be downloaded automatically from the PowershellGallery when PowerLFM is installed. Because of this it will be packaged with PowerLFM to not require it to be installed separately by the user.

Move psd1 and psm1 back under the main source folder

I moved these files out under the main repo folder just to help with testing locally knowing that's not how it should really be done. Moving them back in anticipation of creating a build process to compile everything to what will eventually be published to the PSGallery.

Abstract out code that builds url

Example from Get-LFMAlbumInfo. Move most of this code to a new function. Pass in $PSBoundParameters to new function.

begin {
    $apiParams = @{
        'method' = 'album.getInfo'
        'api_key' = $LFMConfig.APIKey
        'format' = 'json'
    }

    switch ($PSBoundParameters.Keys) {
        'UserName' {$apiParams.Add('username', $UserName)}
        'AutoCorrect' {$apiParams.Add('autocorrect', 1)}
    }
}
process {
    switch ($PSCmdlet.ParameterSetName) {
        'album' {$apiParams.Add('artist', $Artist);
                    $apiParams.Add('album', $Album)}
        'id'    {$apiParams.Add('mbid', $Id)}
    }

    #Building string to append to base url
    $keyValues = $apiParams.GetEnumerator() | ForEach-Object {
        "$($_.Name)=$($_.Value)"
    }
    $string = $keyValues -join '&'

    $apiUrl = "$baseUrl/?$string"
}

More updates to Pester tests

This is mostly to consolidate all interface tests from each function to a single set of interface tests. It uses a json file to reference what each function should look like.

Change Invoke-RestMethod back to Invoke-WebRequest

The successful authenticated method calls weren't returning json when json was selected as the format. They seemed to only return xml. Changing the functions with these authenticated calls to use Invoke-WebRequest and the default format of xml.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.