<commit_before>'use strict';

songbuzzApp.controller('PlaylistDetailController', ['$rootScope',
    '$scope',
    '$timeout',
    '$routeParams',
    'PlayerService',
    'Restangular',
    function ($rootScope, $scope, $timeout, $routeParams, PlayerService, Restangular) {
        $scope.playlistId = $routeParams.playlistId;
        $scope.searchResults = '';
        $scope.playingSong = {};
        $scope.player = {};
        $scope.songDone = true;
        $scope.progress = 0;

        //@tested
        $scope.$on('changePlaylist', function () {
            //$scope.playlist = PlayerService.currentPlaylist;
            $scope.fetchPlaylist(PlayerService.currentPlaylist.id);
        });

        $scope.fetchPlaylist = function(playlistId) {
            Restangular.one('playlist', playlistId).get().then(function(playlist) {
                $scope.playlist = playlist;
                PlayerService.changePlaylist($scope.playlist);
            });

        };

        // Fetch the appropriate playlist.
        // * if there's a playlist ID in the URL, fetch that, otherwise...
        // * if there's a currently playing playlist, fetch that, otherwise...
        // * default the playlist to a blank object.
        if($routeParams.playlistId) {
            $scope.fetchPlaylist($routeParams.playlistId);
        } else if(PlayerService.currentPlaylist != undefined) {
            $scope.fetchPlaylist(PlayerService.currentPlaylist.id);
        }

        $scope.formatYtSong = function (vid) {<commit_msg>Quick fix - the "playing now" functionality for the playlist link was pulling current not playing.<commit_after>'use strict';

songbuzzApp.controller('PlaylistDetailController', ['$rootScope',
    '$scope',
    '$timeout',
    '$routeParams',
    'PlayerService',
    'Restangular',
    function ($rootScope, $scope, $timeout, $routeParams, PlayerService, Restangular) {
        $scope.playlistId = $routeParams.playlistId;
        $scope.searchResults = '';
        $scope.playingSong = {};
        $scope.player = {};
        $scope.songDone = true;
        $scope.progress = 0;

        //@tested
        $scope.$on('changePlaylist', function () {
            //$scope.playlist = PlayerService.currentPlaylist;
            $scope.fetchPlaylist(PlayerService.currentPlaylist.id);
        });

        $scope.fetchPlaylist = function(playlistId) {
            Restangular.one('playlist', playlistId).get().then(function(playlist) {
                $scope.playlist = playlist;
                PlayerService.changePlaylist($scope.playlist);
            });

        };

        // Fetch the appropriate playlist.
        // * if there's a playlist ID in the URL, fetch that, otherwise...
        // * if there's a currently playing playlist, fetch that, otherwise...
        // * if there's a currently selected playlist, fetch that...
        if($routeParams.playlistId) {
            $scope.fetchPlaylist($routeParams.playlistId);
        } else if(PlayerService.playingPlaylist != undefined) {
            $scope.fetchPlaylist(PlayerService.playingPlaylist.id);
        } else if(PlayerService.currentPlaylist != undefined) {
            $scope.fetchPlaylist(PlayerService.currentPlaylist.id);
        }

        $scope.formatYtSong = function (vid) {
{'fraction_non_alphanumeric': 0.12954476015887564, 'fraction_numerical': 0.0006110601894286587, 'mean_word_length': 2.468220338983051, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5825517', 'n_tokens_mistral': 916, 'n_tokens_neox': 879, 'n_words': 175}