<commit_before>var fs = require('fsplus');
var path = require('path');
var geci = require('geci');
var open = require('open');
var home = require('home');
var mkdirp = require('mkdirp');
var Player = require('player');
var color = require('colorful');
var consoler = require('consoler');
var termList = require('term-list-enhanced');

var sdk = require('./sdk');
var utils = require('./utils');
var pkg = require('../package');
var errors = require('./errors');
var template = require('./template');

// Keypress shortcut list
var shorthands = {
  'return': 'play',
  'backspace': 'stop',
  'g': 'go',
  'l': 'loving',
  'n': 'next',
  'q': 'quit',
  's': 'share',
  'r': 'showLrc'
};

module.exports = Fm;

// Class Douban.fm
function Fm() {
  // Fetch user's home
  this.USERHOME = home();

  // Resolve config files' path
  this.path = {};
  this.path.profile = home.resolve('~/.douban.fm.profile.json');
  this.path.history = home.resolve('~/.douban.fm.history.json');

  // Read configs from JSON files
  try {
    this.profile = fs.readJSON(this.path.profile);
  } catch (err) {
    // Ingore missing profile
  }

  // Get music download folder as `this.home`
  this.home = this.profile ?
    this.profile.home :
    home.resolve('~/douban.fm');

  // Get favourite music download folder
  this.love = path.join(this.home, 'love');

  // Get `http_proxy` options
  this.http_proxy = this.profile ?
    this.profile.http_proxy :
    null;

  // Disable Lrc by default
  this.isShowLrc = false;

  // Update UI
  template.updateTab('Douban FM');

  // Ensure music download folder exists,
  // If not, Mkdir of it.
  try {<commit_msg>bug fix 配置项没有配置下载目录时，会报错<commit_after>var fs = require('fsplus');
var path = require('path');
var geci = require('geci');
var open = require('open');
var home = require('home');
var mkdirp = require('mkdirp');
var Player = require('player');
var color = require('colorful');
var consoler = require('consoler');
var termList = require('term-list-enhanced');

var sdk = require('./sdk');
var utils = require('./utils');
var pkg = require('../package');
var errors = require('./errors');
var template = require('./template');

// Keypress shortcut list
var shorthands = {
  'return': 'play',
  'backspace': 'stop',
  'g': 'go',
  'l': 'loving',
  'n': 'next',
  'q': 'quit',
  's': 'share',
  'r': 'showLrc'
};

module.exports = Fm;

// Class Douban.fm
function Fm() {
  // Fetch user's home
  this.USERHOME = home();

  // Resolve config files' path
  this.path = {};
  this.path.profile = home.resolve('~/.douban.fm.profile.json');
  this.path.history = home.resolve('~/.douban.fm.history.json');

  // Read configs from JSON files
  try {
    this.profile = fs.readJSON(this.path.profile);
  } catch (err) {
    // Ingore missing profile
  }

  // Get music download folder as `this.home`
  this.home = this.profile && this.profile.home ?
    this.profile.home :
    home.resolve('~/douban.fm');

  // Get favourite music download folder
  this.love = path.join(this.home, 'love');

  // Get `http_proxy` options
  this.http_proxy = this.profile ?
    this.profile.http_proxy :
    null;

  // Disable Lrc by default
  this.isShowLrc = false;

  // Update UI
  template.updateTab('Douban FM');

  // Ensure music download folder exists,
  // If not, Mkdir of it.
  try {
{'fraction_non_alphanumeric': 0.1816807738814994, 'fraction_numerical': 0.0, 'mean_word_length': 3.371202113606341, '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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1614116', 'n_tokens_mistral': 1151, 'n_tokens_neox': 1119, 'n_words': 293}